==================================================================
BUG: KASAN: use-after-free in dev_map_enqueue+0x40/0x340 kernel/bpf/devmap.c:529
Read of size 8 at addr ffff88811605d200 by task syz.5.566/2500
CPU: 0 PID: 2500 Comm: syz.5.566 Not tainted 6.1.112-syzkaller-00012-g351af49c1d4c #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
dev_map_enqueue+0x40/0x340 kernel/bpf/devmap.c:529
__xdp_do_redirect_frame net/core/filter.c:4294 [inline]
xdp_do_redirect_frame+0x2b5/0x800 net/core/filter.c:4356
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:0x7fd4e0d7e719
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:00007fd4e1b3e038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fd4e0f35f80 RCX: 00007fd4e0d7e719
RDX: 0000000000000050 RSI: 00000000200000c0 RDI: 000000000000000a
RBP: 00007fd4e0df175e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fd4e0f35f80 R15: 00007fff453c2058
Allocated by task 281:
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_slab_alloc+0x6c/0x80 mm/kasan/common.c:333
kasan_slab_alloc include/linux/kasan.h:202 [inline]
slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768
slab_alloc_node mm/slub.c:3421 [inline]
slab_alloc mm/slub.c:3429 [inline]
__kmem_cache_alloc_lru mm/slub.c:3436 [inline]
kmem_cache_alloc+0x175/0x2c0 mm/slub.c:3445
__sigqueue_alloc+0x130/0x200 kernel/signal.c:439
__send_signal_locked+0x1a3/0xc30 kernel/signal.c:1137
send_signal_locked+0x43a/0x590 kernel/signal.c:1266
do_send_sig_info+0xde/0x230 kernel/signal.c:1309
group_send_sig_info+0x113/0x320 kernel/signal.c:1458
bpf_send_signal_common+0x2d8/0x420 kernel/trace/bpf_trace.c:882
____bpf_send_signal kernel/trace/bpf_trace.c:887 [inline]
bpf_send_signal+0x19/0x20 kernel/trace/bpf_trace.c:885
0xffffffffa000221c
bpf_dispatcher_nop_func include/linux/bpf.h:987 [inline]
__bpf_prog_run include/linux/filter.h:603 [inline]
bpf_prog_run include/linux/filter.h:610 [inline]
__bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline]
bpf_trace_run2+0x133/0x290 kernel/trace/bpf_trace.c:2312
__bpf_trace_sys_enter+0x62/0x70 include/trace/events/syscalls.h:18
trace_sys_enter include/trace/events/syscalls.h:18 [inline]
syscall_trace_enter kernel/entry/common.c:81 [inline]
__syscall_enter_from_user_work kernel/entry/common.c:100 [inline]
syscall_enter_from_user_mode+0x176/0x190 kernel/entry/common.c:118
do_syscall_64+0x1e/0xb0 arch/x86/entry/common.c:77
entry_SYSCALL_64_after_hwframe+0x68/0xd2
Freed by task 281:
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:3684 [inline]
kmem_cache_free+0x291/0x510 mm/slub.c:3706
__sigqueue_free kernel/signal.c:462 [inline]
collect_signal kernel/signal.c:605 [inline]
__dequeue_signal+0x519/0x650 kernel/signal.c:627
dequeue_signal+0x165/0x590 kernel/signal.c:650
get_signal+0x54c/0x1820 kernel/signal.c:2768
arch_do_signal_or_restart+0xb0/0x16f0 arch/x86/kernel/signal.c:871
exit_to_user_mode_loop+0x74/0xa0 kernel/entry/common.c:174
exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:303
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2
The buggy address belongs to the object at ffff88811605d1c0
which belongs to the cache sigqueue of size 80
The buggy address is located 64 bytes inside of
80-byte region [ffff88811605d1c0, ffff88811605d210)
The buggy address belongs to the physical page:
page:ffffea0004581740 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11605d
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 0000000000000000 dead000000000122 ffff8881002b3380
raw: 0000000000000000 0000000000240024 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 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 281, tgid 281 (syz-executor), ts 131744709871, free_ts 115866903675
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]
slab_alloc mm/slub.c:3429 [inline]
__kmem_cache_alloc_lru mm/slub.c:3436 [inline]
kmem_cache_alloc+0x1b9/0x2c0 mm/slub.c:3445
__sigqueue_alloc+0x130/0x200 kernel/signal.c:439
__send_signal_locked+0x1a3/0xc30 kernel/signal.c:1137
send_signal_locked+0x43a/0x590 kernel/signal.c:1266
do_send_sig_info+0xde/0x230 kernel/signal.c:1309
group_send_sig_info+0x113/0x320 kernel/signal.c:1458
bpf_send_signal_common+0x2d8/0x420 kernel/trace/bpf_trace.c:882
____bpf_send_signal kernel/trace/bpf_trace.c:887 [inline]
bpf_send_signal+0x19/0x20 kernel/trace/bpf_trace.c:885
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
__free_slab+0xce/0x1a0 mm/slub.c:2039
free_slab mm/slub.c:2054 [inline]
discard_slab mm/slub.c:2060 [inline]
__unfreeze_partials+0x165/0x1a0 mm/slub.c:2609
put_cpu_partial+0xa9/0x100 mm/slub.c:2685
__slab_free+0x1c8/0x280 mm/slub.c:3561
do_slab_free mm/slub.c:3638 [inline]
___cache_free+0xc6/0xd0 mm/slub.c:3691
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0xc5/0x140 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x24/0x80 mm/kasan/common.c:310
kasan_slab_alloc include/linux/kasan.h:202 [inline]
slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768
slab_alloc_node mm/slub.c:3421 [inline]
slab_alloc mm/slub.c:3429 [inline]
__kmem_cache_alloc_lru mm/slub.c:3436 [inline]
kmem_cache_alloc+0x175/0x2c0 mm/slub.c:3445
getname_flags+0xba/0x520 fs/namei.c:139
getname+0x19/0x20 fs/namei.c:218
do_sys_openat2+0xe0/0x870 fs/open.c:1335
Memory state around the buggy address:
ffff88811605d100: fb fb fb fb fb fb fc fc fc fc fa fb fb fb fb fb
ffff88811605d180: fb fb fb fb fc fc fc fc fa fb fb fb fb fb fb fb
>ffff88811605d200: fb fb fc fc fc fc fa fb fb fb fb fb fb fb fb fb
^
ffff88811605d280: fc fc fc fc fa fb fb fb fb fb fb fb fb fb fc fc
ffff88811605d300: fc fc fa fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================
general protection fault, probably for non-canonical address 0xdffffc000000001a: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x00000000000000d0-0x00000000000000d7]
CPU: 0 PID: 2500 Comm: syz.5.566 Tainted: G B 6.1.112-syzkaller-00012-g351af49c1d4c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
RIP: 0010:__xdp_enqueue kernel/bpf/devmap.c:478 [inline]
RIP: 0010:dev_map_enqueue+0x72/0x340 kernel/bpf/devmap.c:531
Code: 89 d8 48 c1 e8 03 42 80 3c 20 00 74 08 48 89 df e8 73 65 25 00 48 8b 03 48 89 45 c8 4d 8d ae d0 00 00 00 4c 89 e8 48 c1 e8 03 <42> 80 3c 20 00 74 08 4c 89 ef e8 4f 65 25 00 bb 20 02 00 00 49 03
RSP: 0018:ffffc90000bd75f8 EFLAGS: 00010202
RAX: 000000000000001a RBX: ffff88811605d220 RCX: ffffffff8197a85d
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff88811605d220
RBP: ffffc90000bd7638 R08: ffffffff8144a2c3 R09: fffffbfff0f6e0fd
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: 00000000000000d0 R14: 0000000000000000 R15: ffff88811ae66070
FS: 00007fd4e1b3e6c0(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000011491f000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600
Call Trace:
__xdp_do_redirect_frame net/core/filter.c:4294 [inline]
xdp_do_redirect_frame+0x2b5/0x800 net/core/filter.c:4356
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:0x7fd4e0d7e719
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:00007fd4e1b3e038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fd4e0f35f80 RCX: 00007fd4e0d7e719
RDX: 0000000000000050 RSI: 00000000200000c0 RDI: 000000000000000a
RBP: 00007fd4e0df175e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fd4e0f35f80 R15: 00007fff453c2058
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__xdp_enqueue kernel/bpf/devmap.c:478 [inline]
RIP: 0010:dev_map_enqueue+0x72/0x340 kernel/bpf/devmap.c:531
Code: 89 d8 48 c1 e8 03 42 80 3c 20 00 74 08 48 89 df e8 73 65 25 00 48 8b 03 48 89 45 c8 4d 8d ae d0 00 00 00 4c 89 e8 48 c1 e8 03 <42> 80 3c 20 00 74 08 4c 89 ef e8 4f 65 25 00 bb 20 02 00 00 49 03
RSP: 0018:ffffc90000bd75f8 EFLAGS: 00010202
RAX: 000000000000001a RBX: ffff88811605d220 RCX: ffffffff8197a85d
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff88811605d220
RBP: ffffc90000bd7638 R08: ffffffff8144a2c3 R09: fffffbfff0f6e0fd
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: 00000000000000d0 R14: 0000000000000000 R15: ffff88811ae66070
FS: 00007fd4e1b3e6c0(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000011491f000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600
----------------
Code disassembly (best guess):
0: 89 d8 mov %ebx,%eax
2: 48 c1 e8 03 shr $0x3,%rax
6: 42 80 3c 20 00 cmpb $0x0,(%rax,%r12,1)
b: 74 08 je 0x15
d: 48 89 df mov %rbx,%rdi
10: e8 73 65 25 00 call 0x256588
15: 48 8b 03 mov (%rbx),%rax
18: 48 89 45 c8 mov %rax,-0x38(%rbp)
1c: 4d 8d ae d0 00 00 00 lea 0xd0(%r14),%r13
23: 4c 89 e8 mov %r13,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 80 3c 20 00 cmpb $0x0,(%rax,%r12,1) <-- trapping instruction
2f: 74 08 je 0x39
31: 4c 89 ef mov %r13,%rdi
34: e8 4f 65 25 00 call 0x256588
39: bb 20 02 00 00 mov $0x220,%ebx
3e: 49 rex.WB
3f: 03 .byte 0x3