==================================================================
BUG: KASAN: use-after-free in dev_map_enqueue+0x40/0x340 kernel/bpf/devmap.c:532
Read of size 8 at addr ffff888116ef1400 by task syz.5.2316/8957
CPU: 1 PID: 8957 Comm: syz.5.2316 Not tainted 6.1.129-syzkaller-00018-g6a8cf1324d00 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
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:532
__xdp_do_redirect_frame net/core/filter.c:4327 [inline]
xdp_do_redirect_frame+0x2b5/0x800 net/core/filter.c:4389
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:3670
__sys_bpf+0x59f/0x7f0 kernel/bpf/syscall.c:5025
__do_sys_bpf kernel/bpf/syscall.c:5111 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5109 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5109
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/0x80 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f2d7e58e969
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:00007f2d7f45d038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f2d7e7b6080 RCX: 00007f2d7e58e969
RDX: 0000000000000050 RSI: 00002000000000c0 RDI: 000000000000000a
RBP: 00007f2d7e610ab1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f2d7e7b6080 R15: 00007ffc1e6746f8
Allocated by task 103:
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:563 [inline]
kzalloc include/linux/slab.h:699 [inline]
kernfs_get_open_node fs/kernfs/file.c:574 [inline]
kernfs_fop_open+0x70e/0xb10 fs/kernfs/file.c:742
do_dentry_open+0x891/0x1250 fs/open.c:884
vfs_open+0x73/0x80 fs/open.c:1015
do_open fs/namei.c:3625 [inline]
path_openat+0x2532/0x2d60 fs/namei.c:3782
do_filp_open+0x230/0x480 fs/namei.c:3809
do_sys_openat2+0x151/0x870 fs/open.c:1341
do_sys_open fs/open.c:1357 [inline]
__do_sys_openat fs/open.c:1373 [inline]
__se_sys_openat fs/open.c:1368 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1368
x64_sys_call+0x6bf/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0x80 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
kernfs_unlink_open_file+0x327/0x3d0 fs/kernfs/file.c:635
kernfs_fop_release+0x253/0x310 fs/kernfs/file.c:807
__fput+0x1e5/0x870 fs/file_table.c:320
____fput+0x15/0x20 fs/file_table.c:348
task_work_run+0x24d/0x2e0 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0x94/0xa0 kernel/entry/common.c:177
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/0x80 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2
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
kvfree_call_rcu+0x9f/0x800 kernel/rcu/tree.c:3445
kernfs_unlink_open_file+0x327/0x3d0 fs/kernfs/file.c:635
kernfs_fop_release+0x253/0x310 fs/kernfs/file.c:807
__fput+0x1e5/0x870 fs/file_table.c:320
____fput+0x15/0x20 fs/file_table.c:348
task_work_run+0x24d/0x2e0 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0x94/0xa0 kernel/entry/common.c:177
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/0x80 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2
The buggy address belongs to the object at ffff888116ef1400
which belongs to the cache kmalloc-96 of size 96
The buggy address is located 0 bytes inside of
96-byte region [ffff888116ef1400, ffff888116ef1460)
The buggy address belongs to the physical page:
page:ffffea00045bbc40 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888116ef1200 pfn:0x116ef1
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 ffffea0004cbcf88 ffffea00046067c8 ffff888100042900
raw: ffff888116ef1200 0000000000200014 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 111, tgid 111 (udevd), ts 9294403631, free_ts 9294333294
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x213/0x220 mm/page_alloc.c:2637
prep_new_page+0x1b/0x110 mm/page_alloc.c:2644
get_page_from_freelist+0x3a98/0x3b10 mm/page_alloc.c:4539
__alloc_pages+0x234/0x610 mm/page_alloc.c:5837
alloc_slab_page+0x6c/0xf0 include/linux/gfp.h:-1
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:563 [inline]
kzalloc include/linux/slab.h:699 [inline]
kernfs_get_open_node fs/kernfs/file.c:574 [inline]
kernfs_fop_open+0x70e/0xb10 fs/kernfs/file.c:742
do_dentry_open+0x891/0x1250 fs/open.c:884
vfs_open+0x73/0x80 fs/open.c:1015
do_open fs/namei.c:3625 [inline]
path_openat+0x2532/0x2d60 fs/namei.c:3782
do_filp_open+0x230/0x480 fs/namei.c:3809
do_sys_openat2+0x151/0x870 fs/open.c:1341
page last free stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
free_pages_prepare mm/page_alloc.c:1545 [inline]
free_pcp_prepare mm/page_alloc.c:1619 [inline]
free_unref_page_prepare+0x9f1/0xa00 mm/page_alloc.c:3581
free_unref_page+0xb2/0x5c0 mm/page_alloc.c:3677
free_the_page mm/page_alloc.c:830 [inline]
__free_pages+0x61/0xf0 mm/page_alloc.c:5926
free_pages+0x7c/0x90 mm/page_alloc.c:5937
selinux_genfs_get_sid+0x24d/0x2a0 security/selinux/hooks.c:1303
inode_doinit_with_dentry+0x8d2/0x1070 security/selinux/hooks.c:1498
selinux_d_instantiate+0x27/0x40 security/selinux/hooks.c:6390
security_d_instantiate+0x9f/0x100 security/security.c:2096
d_splice_alias+0x6d/0x390 fs/dcache.c:3153
kernfs_iop_lookup+0x29e/0x2f0 fs/kernfs/dir.c:1204
__lookup_slow+0x2b9/0x3e0 fs/namei.c:1689
lookup_slow+0x5a/0x80 fs/namei.c:1706
walk_component+0x2e7/0x410 fs/namei.c:1997
lookup_last fs/namei.c:2454 [inline]
path_lookupat+0x16d/0x450 fs/namei.c:2478
filename_lookup+0x251/0x600 fs/namei.c:2507
vfs_statx+0x107/0x4b0 fs/stat.c:229
Memory state around the buggy address:
ffff888116ef1300: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc
ffff888116ef1380: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff888116ef1400: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff888116ef1480: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc
ffff888116ef1500: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================
general protection fault, probably for non-canonical address 0xdffffc0000000044: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000220-0x0000000000000227]
CPU: 1 PID: 8957 Comm: syz.5.2316 Tainted: G B 6.1.129-syzkaller-00018-g6a8cf1324d00 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
RIP: 0010:__xdp_enqueue kernel/bpf/devmap.c:481 [inline]
RIP: 0010:dev_map_enqueue+0x91/0x340 kernel/bpf/devmap.c:534
Code: d0 00 00 00 4c 89 e8 48 c1 e8 03 42 80 3c 20 00 74 08 4c 89 ef e8 af a3 25 00 bb 20 02 00 00 49 03 5d 00 48 89 d8 48 c1 e8 03 <42> 80 3c 20 00 74 08 48 89 df e8 90 a3 25 00 48 83 3b 00 0f 84 eb
RSP: 0018:ffffc90000aa75f8 EFLAGS: 00010206
RAX: 0000000000000044 RBX: 0000000000000220 RCX: ffffffff81974621
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff888116ef1350
RBP: ffffc90000aa7638 R08: ffffffff81448a83 R09: fffffbfff0f6e8fd
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: ffff888116ef1350 R14: ffff888116ef1280 R15: ffff88813dd1f070
FS: 00007f2d7f45d6c0(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000100000002 CR3: 000000015545c000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000200000000300 DR2: 0000200000000300
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600
Call Trace:
__xdp_do_redirect_frame net/core/filter.c:4327 [inline]
xdp_do_redirect_frame+0x2b5/0x800 net/core/filter.c:4389
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:3670
__sys_bpf+0x59f/0x7f0 kernel/bpf/syscall.c:5025
__do_sys_bpf kernel/bpf/syscall.c:5111 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5109 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5109
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/0x80 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f2d7e58e969
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:00007f2d7f45d038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f2d7e7b6080 RCX: 00007f2d7e58e969
RDX: 0000000000000050 RSI: 00002000000000c0 RDI: 000000000000000a
RBP: 00007f2d7e610ab1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f2d7e7b6080 R15: 00007ffc1e6746f8
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__xdp_enqueue kernel/bpf/devmap.c:481 [inline]
RIP: 0010:dev_map_enqueue+0x91/0x340 kernel/bpf/devmap.c:534
Code: d0 00 00 00 4c 89 e8 48 c1 e8 03 42 80 3c 20 00 74 08 4c 89 ef e8 af a3 25 00 bb 20 02 00 00 49 03 5d 00 48 89 d8 48 c1 e8 03 <42> 80 3c 20 00 74 08 48 89 df e8 90 a3 25 00 48 83 3b 00 0f 84 eb
RSP: 0018:ffffc90000aa75f8 EFLAGS: 00010206
RAX: 0000000000000044 RBX: 0000000000000220 RCX: ffffffff81974621
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff888116ef1350
RBP: ffffc90000aa7638 R08: ffffffff81448a83 R09: fffffbfff0f6e8fd
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: ffff888116ef1350 R14: ffff888116ef1280 R15: ffff88813dd1f070
FS: 00007f2d7f45d6c0(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000100000002 CR3: 000000015545c000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000200000000300 DR2: 0000200000000300
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600
----------------
Code disassembly (best guess):
0: d0 00 rolb (%rax)
2: 00 00 add %al,(%rax)
4: 4c 89 e8 mov %r13,%rax
7: 48 c1 e8 03 shr $0x3,%rax
b: 42 80 3c 20 00 cmpb $0x0,(%rax,%r12,1)
10: 74 08 je 0x1a
12: 4c 89 ef mov %r13,%rdi
15: e8 af a3 25 00 call 0x25a3c9
1a: bb 20 02 00 00 mov $0x220,%ebx
1f: 49 03 5d 00 add 0x0(%r13),%rbx
23: 48 89 d8 mov %rbx,%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: 48 89 df mov %rbx,%rdi
34: e8 90 a3 25 00 call 0x25a3c9
39: 48 83 3b 00 cmpq $0x0,(%rbx)
3d: 0f .byte 0xf
3e: 84 eb test %ch,%bl