syzbot


KASAN: use-after-free Read in dev_map_enqueue

Status: upstream: reported on 2025/03/22 21:42
Reported-by: syzbot+b75f92728482c2e0f1b7@syzkaller.appspotmail.com
First crash: 58d, last: 58d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 general protection fault in dev_map_enqueue missing-backport C 1695 25d 419d 0/2 upstream: reported C repro on 2024/03/26 23:53
linux-6.1 general protection fault in dev_map_enqueue origin:upstream missing-backport C unreliable 199 22d 419d 0/3 upstream: reported C repro on 2024/03/26 19:03
android-5-15 general protection fault in dev_map_enqueue 1 116d 116d 0/2 auto-obsoleted due to no activity on 2025/04/23 18:09
upstream general protection fault in dev_map_enqueue bpf net C 676 362d 419d 25/28 fixed on 2024/05/22 23:26
upstream general protection fault in dev_map_enqueue (2) bpf net C error done 336 292d 358d 28/28 fixed on 2024/11/12 23:31

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in dev_map_enqueue+0x48/0x1ec kernel/bpf/devmap.c:531
Read of size 8 at addr ffff0000c8f02c00 by task kworker/1:5/4074

CPU: 1 PID: 4074 Comm: kworker/1:5 Not tainted 5.15.179-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: mld mld_ifc_work
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x174/0x1e4 mm/kasan/report.c:451
 __asan_report_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309
 dev_map_enqueue+0x48/0x1ec kernel/bpf/devmap.c:531
 __xdp_do_redirect_frame net/core/filter.c:4089 [inline]
 xdp_do_redirect+0x4bc/0xd64 net/core/filter.c:4129
 veth_xdp_rcv_skb drivers/net/veth.c:798 [inline]
 veth_xdp_rcv drivers/net/veth.c:883 [inline]
 veth_poll+0x1658/0x3a84 drivers/net/veth.c:919
 __napi_poll+0xb4/0x624 net/core/dev.c:7074
 napi_poll net/core/dev.c:7141 [inline]
 net_rx_action+0x500/0xc10 net/core/dev.c:7231
 handle_softirqs+0x384/0xdbc kernel/softirq.c:558
 __do_softirq kernel/softirq.c:592 [inline]
 do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline]
 do_softirq+0xfc/0x1b0 kernel/softirq.c:459
 __local_bh_enable_ip+0x298/0x470 kernel/softirq.c:383
 local_bh_enable+0x28/0x34 include/linux/bottom_half.h:32
 rcu_read_unlock_bh include/linux/rcupdate.h:809 [inline]
 ip6_finish_output2+0x1400/0x1cec net/ipv6/ip6_output.c:131
 __ip6_finish_output+0x580/0x6ec net/ipv6/ip6_output.c:201
 ip6_finish_output+0x40/0x218 net/ipv6/ip6_output.c:211
 NF_HOOK_COND include/linux/netfilter.h:291 [inline]
 ip6_output+0x274/0x594 net/ipv6/ip6_output.c:234
 dst_output include/net/dst.h:452 [inline]
 NF_HOOK+0x160/0x4ec include/linux/netfilter.h:302
 mld_sendpack+0x82c/0x1268 net/ipv6/mcast.c:1826
 mld_send_cr net/ipv6/mcast.c:2127 [inline]
 mld_ifc_work+0x798/0xa3c net/ipv6/mcast.c:2659
 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310
 worker_thread+0x910/0x1034 kernel/workqueue.c:2457
 kthread+0x37c/0x45c kernel/kthread.c:334
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

Allocated by task 6640:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc+0xbc/0xfc mm/kasan/common.c:513
 __kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x27c/0x47c mm/slub.c:3247
 kmalloc include/linux/slab.h:591 [inline]
 single_open+0x6c/0x248 fs/seq_file.c:591
 proc_single_open+0x84/0x98 fs/proc/generic.c:636
 proc_reg_open+0x1bc/0x4b8 fs/proc/inode.c:524
 do_dentry_open+0x780/0xed8 fs/open.c:826
 vfs_open+0x7c/0x90 fs/open.c:956
 do_open fs/namei.c:3608 [inline]
 path_openat+0x1ea0/0x26cc fs/namei.c:3742
 do_filp_open+0x1a8/0x3b4 fs/namei.c:3769
 do_sys_openat2+0x128/0x3e0 fs/open.c:1253
 do_sys_open fs/open.c:1269 [inline]
 __do_sys_openat fs/open.c:1285 [inline]
 __se_sys_openat fs/open.c:1280 [inline]
 __arm64_sys_openat+0x1f0/0x240 fs/open.c:1280
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the object at ffff0000c8f02c00
 which belongs to the cache kmalloc-cg-128 of size 128
The buggy address is located 0 bytes inside of
 128-byte region [ffff0000c8f02c00, ffff0000c8f02c80)
The buggy address belongs to the page:
page:0000000062783a11 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x108f02
memcg:ffff0000c2c0ac01
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 dead000000000100 dead000000000122 ffff0000c0002d80
raw: 0000000000000000 0000000080100010 00000001ffffffff ffff0000c2c0ac01
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000c8f02b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000c8f02b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000c8f02c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff0000c8f02c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000c8f02d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
==================================================================
Unable to handle kernel paging request at virtual address dfff800000000047
Mem abort info:
  ESR = 0x0000000096000006
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x06: level 2 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000006
  CM = 0, WnR = 0
[dfff800000000047] address between user and kernel address ranges
Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 4074 Comm: kworker/1:5 Tainted: G    B             5.15.179-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: mld mld_ifc_work
pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __xdp_enqueue kernel/bpf/devmap.c:480 [inline]
pc : dev_map_enqueue+0x88/0x1ec kernel/bpf/devmap.c:533
lr : __xdp_enqueue kernel/bpf/devmap.c:480 [inline]
lr : dev_map_enqueue+0x7c/0x1ec kernel/bpf/devmap.c:533
sp : ffff80001fda6cd0
x29: ffff80001fda6ce0 x28: dfff800000000000 x27: ffff0001b41a66d0
x26: ffff0001b41a66d4 x25: ffff0000c259a000 x24: dfff800000000000
x23: 0000000000000238 x22: 0000000000000000 x21: ffff0000c231a930
x20: ffff0000c259a000 x19: ffff0000cd95a000 x18: 0000000000000103
x17: 0000000000000000 x16: ffff80000824f3a0 x15: 00000000ffffffff
x14: ffff0000c22b9b40 x13: 0000000000000001 x12: ffff700002e3ad64
x11: 0000000000000101 x10: 0000000000000000 x9 : ffff80001b849390
x8 : 0000000000000047 x7 : 0000000000000000 x6 : 0000000000000001
x5 : ffff80001fda6378 x4 : 0000000000000000 x3 : ffff80000864c0f4
x2 : 0000000000000000 x1 : 0000000000000008 x0 : 0000000000000000
Call trace:
 __xdp_enqueue kernel/bpf/devmap.c:480 [inline]
 dev_map_enqueue+0x88/0x1ec kernel/bpf/devmap.c:533
 __xdp_do_redirect_frame net/core/filter.c:4089 [inline]
 xdp_do_redirect+0x4bc/0xd64 net/core/filter.c:4129
 veth_xdp_rcv_skb drivers/net/veth.c:798 [inline]
 veth_xdp_rcv drivers/net/veth.c:883 [inline]
 veth_poll+0x1658/0x3a84 drivers/net/veth.c:919
 __napi_poll+0xb4/0x624 net/core/dev.c:7074
 napi_poll net/core/dev.c:7141 [inline]
 net_rx_action+0x500/0xc10 net/core/dev.c:7231
 handle_softirqs+0x384/0xdbc kernel/softirq.c:558
 __do_softirq kernel/softirq.c:592 [inline]
 do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline]
 do_softirq+0xfc/0x1b0 kernel/softirq.c:459
 __local_bh_enable_ip+0x298/0x470 kernel/softirq.c:383
 local_bh_enable+0x28/0x34 include/linux/bottom_half.h:32
 rcu_read_unlock_bh include/linux/rcupdate.h:809 [inline]
 ip6_finish_output2+0x1400/0x1cec net/ipv6/ip6_output.c:131
 __ip6_finish_output+0x580/0x6ec net/ipv6/ip6_output.c:201
 ip6_finish_output+0x40/0x218 net/ipv6/ip6_output.c:211
 NF_HOOK_COND include/linux/netfilter.h:291 [inline]
 ip6_output+0x274/0x594 net/ipv6/ip6_output.c:234
 dst_output include/net/dst.h:452 [inline]
 NF_HOOK+0x160/0x4ec include/linux/netfilter.h:302
 mld_sendpack+0x82c/0x1268 net/ipv6/mcast.c:1826
 mld_send_cr net/ipv6/mcast.c:2127 [inline]
 mld_ifc_work+0x798/0xa3c net/ipv6/mcast.c:2659
 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310
 worker_thread+0x910/0x1034 kernel/workqueue.c:2457
 kthread+0x37c/0x45c kernel/kthread.c:334
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870
Code: 940a2f16 f94002e8 9108e117 d343fee8 (38786908) 
---[ end trace b3434fcf658b3da8 ]---
----------------
Code disassembly (best guess):
   0:	940a2f16 	bl	0x28bc58
   4:	f94002e8 	ldr	x8, [x23]
   8:	9108e117 	add	x23, x8, #0x238
   c:	d343fee8 	lsr	x8, x23, #3
* 10:	38786908 	ldrb	w8, [x8, x24] <-- trapping instruction

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/22 21:41 linux-5.15.y 0c935c049b5c c6512ef7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in dev_map_enqueue
* Struck through repros no longer work on HEAD.