syzbot


KASAN: use-after-free Read in cpu_map_generic_redirect

Status: upstream: reported on 2025/02/06 04:04
Reported-by: syzbot+4c72e4a4d9e0fcb10024@syzkaller.appspotmail.com
First crash: 17d, last: 4d01h
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Read in cpu_map_generic_redirect 10 4d00h 39d 0/2 premoderation: reported on 2025/01/15 04:15
android-6-1 KASAN: use-after-free Read in cpu_map_generic_redirect 4 107d 186d 0/2 auto-obsoleted due to no activity on 2025/02/06 07:47
linux-6.1 KASAN: use-after-free Read in cpu_map_generic_redirect 5 44d 163d 0/3 upstream: reported on 2024/09/13 03:13

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in cpu_map_generic_redirect+0x1b9/0x5d0 kernel/bpf/cpumap.c:786
Read of size 8 at addr ffff88801817e418 by task kworker/0:11/4272

CPU: 0 PID: 4272 Comm: kworker/0:11 Not tainted 5.15.178-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Workqueue: wg-crypt-wg1 wg_packet_tx_worker
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 cpu_map_generic_redirect+0x1b9/0x5d0 kernel/bpf/cpumap.c:786
 xdp_do_generic_redirect_map net/core/filter.c:4189 [inline]
 xdp_do_generic_redirect+0x401/0x850 net/core/filter.c:4236
 do_xdp_generic+0x4f5/0x6c0 net/core/dev.c:4911
 __netif_receive_skb_core+0x1bf1/0x3df0 net/core/dev.c:5316
 __netif_receive_skb_one_core net/core/dev.c:5491 [inline]
 __netif_receive_skb+0x11c/0x530 net/core/dev.c:5607
 process_backlog+0x363/0x7f0 net/core/dev.c:6484
 __napi_poll+0xc7/0x440 net/core/dev.c:7043
 napi_poll net/core/dev.c:7110 [inline]
 net_rx_action+0x617/0xda0 net/core/dev.c:7200
 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
 do_softirq+0x162/0x240 kernel/softirq.c:459
 </IRQ>
 <TASK>
 __local_bh_enable_ip+0x1b1/0x1f0 kernel/softirq.c:383
 wg_socket_send_skb_to_peer+0x172/0x1d0 drivers/net/wireguard/socket.c:184
 wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline]
 wg_packet_tx_worker+0x1a1/0x7a0 drivers/net/wireguard/send.c:276
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 5099:
 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+0xba/0xf0 mm/kasan/common.c:513
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 alloc_mnt_ns+0xaf/0x3b0 fs/namespace.c:3398
 copy_mnt_ns+0xcb/0x9a0 fs/namespace.c:3443
 create_new_namespaces+0xd3/0x7a0 kernel/nsproxy.c:78
 unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226
 ksys_unshare+0x531/0xa40 kernel/fork.c:3099
 __do_sys_unshare kernel/fork.c:3173 [inline]
 __se_sys_unshare kernel/fork.c:3171 [inline]
 __x64_sys_unshare+0x34/0x40 kernel/fork.c:3171
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 insert_work+0x54/0x3e0 kernel/workqueue.c:1366
 __queue_work+0x963/0xd00 kernel/workqueue.c:1532
 queue_work_on+0x14b/0x250 kernel/workqueue.c:1559
 cpu_map_free+0xd7/0x1b0 kernel/bpf/cpumap.c:638
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Second to last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
 __cpu_map_entry_replace+0x74/0x170 kernel/bpf/cpumap.c:553
 cpu_map_free+0xd7/0x1b0 kernel/bpf/cpumap.c:638
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

The buggy address belongs to the object at ffff88801817e400
 which belongs to the cache kmalloc-cg-256 of size 256
The buggy address is located 24 bytes inside of
 256-byte region [ffff88801817e400, ffff88801817e500)
The buggy address belongs to the page:
page:ffffea0000605f80 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801817fa00 pfn:0x1817e
head:ffffea0000605f80 order:1 compound_mapcount:0
memcg:ffff888021a26f01
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888017442c80
raw: ffff88801817fa00 000000008010000b 00000001ffffffff ffff888021a26f01
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x0(), pid 1, ts 2170166294, free_ts 0
 create_dummy_stack mm/page_owner.c:59 [inline]
 register_early_stack+0x86/0xe0 mm/page_owner.c:75
 init_page_owner+0x3a/0x730 mm/page_owner.c:85
 kernel_init_freeable+0x420/0x5c0 init/main.c:1613
 kernel_init+0x19/0x290 init/main.c:1506
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88801817e300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88801817e380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88801817e400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88801817e480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801817e500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/02/19 16:52 linux-5.15.y c16c81c81336 b257a9b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in cpu_map_generic_redirect
2025/02/19 16:52 linux-5.15.y c16c81c81336 b257a9b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in cpu_map_generic_redirect
2025/02/19 16:52 linux-5.15.y c16c81c81336 b257a9b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in cpu_map_generic_redirect
2025/02/06 04:03 linux-5.15.y c16c81c81336 577d049b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in cpu_map_generic_redirect
* Struck through repros no longer work on HEAD.