==================================================================
BUG: KASAN: use-after-free in bq_enqueue kernel/bpf/cpumap.c:749 [inline]
BUG: KASAN: use-after-free in cpu_map_enqueue+0xb4/0x370 kernel/bpf/cpumap.c:775
Read of size 8 at addr ffff88811d1ba008 by task syz.2.676/2890
CPU: 0 PID: 2890 Comm: syz.2.676 Not tainted 6.1.115-syzkaller-00041-ga887a44ace2a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:316 [inline]
print_report+0x158/0x4e0 mm/kasan/report.c:427
kasan_report+0x13c/0x170 mm/kasan/report.c:531
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:351
bq_enqueue kernel/bpf/cpumap.c:749 [inline]
cpu_map_enqueue+0xb4/0x370 kernel/bpf/cpumap.c:775
__xdp_do_redirect_frame net/core/filter.c:4300 [inline]
xdp_do_redirect_frame+0x275/0x800 net/core/filter.c:4358
xdp_test_run_batch net/bpf/test_run.c:314 [inline]
bpf_test_run_xdp_live+0xc30/0x1f70 net/bpf/test_run.c:362
bpf_prog_test_run_xdp+0x7d1/0x1130 net/bpf/test_run.c:1393
bpf_prog_test_run+0x3b0/0x630 kernel/bpf/syscall.c:3665
__sys_bpf+0x59f/0x7f0 kernel/bpf/syscall.c:5020
__do_sys_bpf kernel/bpf/syscall.c:5106 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5104 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5104
x64_sys_call+0x87f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:322
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7ff091b80849
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ff092a01058 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007ff091d45fa0 RCX: 00007ff091b80849
RDX: 0000000000000050 RSI: 00000000200000c0 RDI: 000000000000000a
RBP: 00007ff091bf3986 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007ff091d45fa0 R15: 00007ffc4c4fdad8
Allocated by task 2722:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505
____kasan_kmalloc mm/kasan/common.c:379 [inline]
__kasan_kmalloc+0x9c/0xb0 mm/kasan/common.c:388
kasan_kmalloc include/linux/kasan.h:212 [inline]
kmalloc_trace+0x44/0xa0 mm/slab_common.c:1033
kmalloc include/linux/slab.h:557 [inline]
kzalloc include/linux/slab.h:693 [inline]
push_stack+0x8e/0x4f0 kernel/bpf/verifier.c:1227
check_cond_jmp_op kernel/bpf/verifier.c:10484 [inline]
do_check+0x9369/0xe040 kernel/bpf/verifier.c:12723
do_check_common+0x6ca/0xca0 kernel/bpf/verifier.c:14927
do_check_main kernel/bpf/verifier.c:14990 [inline]
bpf_check+0x6d0d/0x17ec0 kernel/bpf/verifier.c:15567
bpf_prog_load+0x1304/0x1bf0 kernel/bpf/syscall.c:2626
__sys_bpf+0x52c/0x7f0 kernel/bpf/syscall.c:5002
__do_sys_bpf kernel/bpf/syscall.c:5106 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5104 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5104
x64_sys_call+0x87f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:322
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
Freed by task 2722:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516
____kasan_slab_free+0x131/0x180 mm/kasan/common.c:241
__kasan_slab_free+0x11/0x20 mm/kasan/common.c:249
kasan_slab_free include/linux/kasan.h:178 [inline]
slab_free_hook mm/slub.c:1745 [inline]
slab_free_freelist_hook mm/slub.c:1771 [inline]
slab_free mm/slub.c:3686 [inline]
__kmem_cache_free+0x21d/0x410 mm/slub.c:3702
kfree+0x7a/0xf0 mm/slab_common.c:990
pop_stack kernel/bpf/verifier.c:1213 [inline]
do_check+0x7bfe/0xe040 kernel/bpf/verifier.c:12712
do_check_common+0x6ca/0xca0 kernel/bpf/verifier.c:14927
do_check_main kernel/bpf/verifier.c:14990 [inline]
bpf_check+0x6d0d/0x17ec0 kernel/bpf/verifier.c:15567
bpf_prog_load+0x1304/0x1bf0 kernel/bpf/syscall.c:2626
__sys_bpf+0x52c/0x7f0 kernel/bpf/syscall.c:5002
__do_sys_bpf kernel/bpf/syscall.c:5106 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5104 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5104
x64_sys_call+0x87f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:322
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
Last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486
kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
kvfree_call_rcu+0x9f/0x800 kernel/rcu/tree.c:3445
drop_sysctl_table+0x311/0x450 fs/proc/proc_sysctl.c:1727
unregister_sysctl_table+0x76/0x120 fs/proc/proc_sysctl.c:1765
unregister_net_sysctl_table+0x15/0x20 net/sysctl_net.c:175
nf_ct_frags6_sysctl_unregister net/ipv6/netfilter/nf_conntrack_reasm.c:110 [inline]
nf_ct_net_exit+0xec/0x140 net/ipv6/netfilter/nf_conntrack_reasm.c:527
ops_exit_list net/core/net_namespace.c:172 [inline]
cleanup_net+0x64b/0xbf0 net/core/net_namespace.c:604
process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
worker_thread+0xa60/0x1260 kernel/workqueue.c:2446
kthread+0x26d/0x300 kernel/kthread.c:386
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
Second to last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486
kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
__call_rcu_common kernel/rcu/tree.c:2807 [inline]
call_rcu+0xdc/0x10f0 kernel/rcu/tree.c:2926
neigh_parms_release+0x1f2/0x230 net/core/neighbour.c:1751
inetdev_destroy net/ipv4/devinet.c:330 [inline]
inetdev_event+0x86e/0x1110 net/ipv4/devinet.c:1615
notifier_call_chain kernel/notifier.c:87 [inline]
raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:455
call_netdevice_notifiers_info net/core/dev.c:1978 [inline]
call_netdevice_notifiers_extack net/core/dev.c:2016 [inline]
call_netdevice_notifiers net/core/dev.c:2030 [inline]
unregister_netdevice_many+0xe25/0x1730 net/core/dev.c:10906
ip6gre_exit_batch_net+0x5b5/0x600 net/ipv6/ip6_gre.c:1669
ops_exit_list net/core/net_namespace.c:177 [inline]
cleanup_net+0x6c9/0xbf0 net/core/net_namespace.c:604
process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
worker_thread+0xa60/0x1260 kernel/workqueue.c:2446
kthread+0x26d/0x300 kernel/kthread.c:386
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
The buggy address belongs to the object at ffff88811d1ba000
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 8 bytes inside of
192-byte region [ffff88811d1ba000, ffff88811d1ba0c0)
The buggy address belongs to the physical page:
page:ffffea0004746e80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11d1ba
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 dead000000000100 dead000000000122 ffff888100042c00
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 790, tgid 788 (syz.3.117), ts 38346833818, free_ts 38344237583
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x213/0x220 mm/page_alloc.c:2590
prep_new_page+0x1b/0x110 mm/page_alloc.c:2597
get_page_from_freelist+0x2980/0x2a10 mm/page_alloc.c:4439
__alloc_pages+0x234/0x610 mm/page_alloc.c:5728
alloc_slab_page+0x6c/0xf0
allocate_slab mm/slub.c:1962 [inline]
new_slab+0x90/0x3e0 mm/slub.c:2015
___slab_alloc+0x6f9/0xb80 mm/slub.c:3203
__slab_alloc+0x5d/0xa0 mm/slub.c:3302
slab_alloc_node mm/slub.c:3387 [inline]
__kmem_cache_alloc_node+0x207/0x2a0 mm/slub.c:3462
kmalloc_trace+0x2a/0xa0 mm/slab_common.c:1028
kmalloc include/linux/slab.h:557 [inline]
kzalloc include/linux/slab.h:693 [inline]
push_stack+0x8e/0x4f0 kernel/bpf/verifier.c:1227
check_cond_jmp_op kernel/bpf/verifier.c:10484 [inline]
do_check+0x9369/0xe040 kernel/bpf/verifier.c:12723
do_check_common+0x6ca/0xca0 kernel/bpf/verifier.c:14927
do_check_main kernel/bpf/verifier.c:14990 [inline]
bpf_check+0x6d0d/0x17ec0 kernel/bpf/verifier.c:15567
bpf_prog_load+0x1304/0x1bf0 kernel/bpf/syscall.c:2626
__sys_bpf+0x52c/0x7f0 kernel/bpf/syscall.c:5002
page last free stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
free_pages_prepare mm/page_alloc.c:1498 [inline]
free_pcp_prepare mm/page_alloc.c:1572 [inline]
free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3511
free_unref_page+0xb2/0x5c0 mm/page_alloc.c:3607
free_the_page mm/page_alloc.c:798 [inline]
__free_pages+0x61/0xf0 mm/page_alloc.c:5817
__vunmap+0x9f3/0xb60 mm/vmalloc.c:2728
__vfree mm/vmalloc.c:2776 [inline]
vfree+0x5c/0x80 mm/vmalloc.c:2807
__bpf_prog_free+0xd3/0xe0 kernel/bpf/core.c:271
bpf_prog_unlock_free include/linux/filter.h:896 [inline]
bpf_jit_free+0x1aa/0x1e0 arch/x86/net/bpf_jit_comp.c:2592
bpf_prog_free_deferred+0x63e/0x750 kernel/bpf/core.c:2580
process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
worker_thread+0xa60/0x1260 kernel/workqueue.c:2446
kthread+0x26d/0x300 kernel/kthread.c:386
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
Memory state around the buggy address:
ffff88811d1b9f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88811d1b9f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88811d1ba000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88811d1ba080: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88811d1ba100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
general protection fault, probably for non-canonical address 0xe0e5ad393edc015f: 0000 [#1] PREEMPT SMP KASAN
KASAN: maybe wild-memory-access in range [0x072d89c9f6e00af8-0x072d89c9f6e00aff]
CPU: 0 PID: 2890 Comm: syz.2.676 Tainted: G B 6.1.115-syzkaller-00041-ga887a44ace2a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
RIP: 0010:bq_enqueue kernel/bpf/cpumap.c:751 [inline]
RIP: 0010:cpu_map_enqueue+0x113/0x370 kernel/bpf/cpumap.c:775
Code: e8 03 42 80 3c 30 00 74 08 48 89 df e8 66 e5 24 00 4c 8b 23 4f 8d 74 3c 58 4d 89 f5 49 c1 ed 03 48 b8 00 00 00 00 00 fc ff df <41> 0f b6 44 05 00 84 c0 0f 85 a8 01 00 00 4d 01 fc 41 8b 1e bf 08
RSP: 0018:ffffc9000ead7600 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffffffff86749890 RCX: 0000000000080000
RDX: ffffc9000228d000 RSI: 0000000000033ac6 RDI: 0000000000033ac7
RBP: ffffc9000ead7638 R08: ffffffff8198100e R09: fffffbfff0f6e2fd
R10: 0000000000000000 R11: dffffc0000000001 R12: ffff8881f6e00000
R13: 00e5b1393edc015f R14: 072d89c9f6e00afa R15: 072e014800000aa2
FS: 00007ff092a016c0(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000100000000 CR3: 000000011e7e2000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600
Call Trace:
__xdp_do_redirect_frame net/core/filter.c:4300 [inline]
xdp_do_redirect_frame+0x275/0x800 net/core/filter.c:4358
xdp_test_run_batch net/bpf/test_run.c:314 [inline]
bpf_test_run_xdp_live+0xc30/0x1f70 net/bpf/test_run.c:362
bpf_prog_test_run_xdp+0x7d1/0x1130 net/bpf/test_run.c:1393
bpf_prog_test_run+0x3b0/0x630 kernel/bpf/syscall.c:3665
__sys_bpf+0x59f/0x7f0 kernel/bpf/syscall.c:5020
__do_sys_bpf kernel/bpf/syscall.c:5106 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5104 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5104
x64_sys_call+0x87f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:322
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7ff091b80849
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ff092a01058 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007ff091d45fa0 RCX: 00007ff091b80849
RDX: 0000000000000050 RSI: 00000000200000c0 RDI: 000000000000000a
RBP: 00007ff091bf3986 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007ff091d45fa0 R15: 00007ffc4c4fdad8
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bq_enqueue kernel/bpf/cpumap.c:751 [inline]
RIP: 0010:cpu_map_enqueue+0x113/0x370 kernel/bpf/cpumap.c:775
Code: e8 03 42 80 3c 30 00 74 08 48 89 df e8 66 e5 24 00 4c 8b 23 4f 8d 74 3c 58 4d 89 f5 49 c1 ed 03 48 b8 00 00 00 00 00 fc ff df <41> 0f b6 44 05 00 84 c0 0f 85 a8 01 00 00 4d 01 fc 41 8b 1e bf 08
RSP: 0018:ffffc9000ead7600 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffffffff86749890 RCX: 0000000000080000
RDX: ffffc9000228d000 RSI: 0000000000033ac6 RDI: 0000000000033ac7
RBP: ffffc9000ead7638 R08: ffffffff8198100e R09: fffffbfff0f6e2fd
R10: 0000000000000000 R11: dffffc0000000001 R12: ffff8881f6e00000
R13: 00e5b1393edc015f R14: 072d89c9f6e00afa R15: 072e014800000aa2
FS: 00007ff092a016c0(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000100000000 CR3: 000000011e7e2000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600
----------------
Code disassembly (best guess):
0: e8 03 42 80 3c call 0x3c804208
5: 30 00 xor %al,(%rax)
7: 74 08 je 0x11
9: 48 89 df mov %rbx,%rdi
c: e8 66 e5 24 00 call 0x24e577
11: 4c 8b 23 mov (%rbx),%r12
14: 4f 8d 74 3c 58 lea 0x58(%r12,%r15,1),%r14
19: 4d 89 f5 mov %r14,%r13
1c: 49 c1 ed 03 shr $0x3,%r13
20: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
27: fc ff df
* 2a: 41 0f b6 44 05 00 movzbl 0x0(%r13,%rax,1),%eax <-- trapping instruction
30: 84 c0 test %al,%al
32: 0f 85 a8 01 00 00 jne 0x1e0
38: 4d 01 fc add %r15,%r12
3b: 41 8b 1e mov (%r14),%ebx
3e: bf .byte 0xbf
3f: 08 .byte 0x8