==================================================================
BUG: KASAN: use-after-free in dev_map_generic_redirect+0x9f/0x7d0 kernel/bpf/devmap.c:668
Read of size 8 at addr ffff88813a325480 by task syz.0.5102/11980
CPU: 0 PID: 11980 Comm: syz.0.5102 Tainted: G W 6.1.128-syzkaller-00031-gf628136006cc #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_generic_redirect+0x9f/0x7d0 kernel/bpf/devmap.c:668
xdp_do_generic_redirect_map net/core/filter.c:4415 [inline]
xdp_do_generic_redirect+0x42e/0xb40 net/core/filter.c:4474
do_xdp_generic+0x53e/0x800 net/core/dev.c:4968
__netif_receive_skb_core+0x19ae/0x43d0 net/core/dev.c:5375
__netif_receive_skb_one_core net/core/dev.c:5552 [inline]
__netif_receive_skb+0x11c/0x530 net/core/dev.c:5668
process_backlog+0x32c/0x630 net/core/dev.c:5996
__napi_poll+0xbe/0x5c0 net/core/dev.c:6563
napi_poll net/core/dev.c:6630 [inline]
net_rx_action+0x595/0xdd0 net/core/dev.c:6744
handle_softirqs+0x1db/0x650 kernel/softirq.c:624
__do_softirq+0xb/0xd kernel/softirq.c:662
do_softirq+0xf6/0x150 kernel/softirq.c:506
__local_bh_enable_ip+0x75/0x80 kernel/softirq.c:430
local_bh_enable include/linux/bottom_half.h:33 [inline]
netif_rx+0x84/0x2c0 net/core/dev.c:5070
tipc_clone_to_loopback+0x3be/0x4a0 net/tipc/bearer.c:789
tipc_loopback_trace net/tipc/bearer.h:256 [inline]
tipc_mcast_xmit+0x1676/0x1b40 net/tipc/bcast.c:423
tipc_sendmcast net/tipc/socket.c:887 [inline]
__tipc_sendmsg+0x2617/0x3240 net/tipc/socket.c:1469
tipc_sendmsg+0x55/0x70 net/tipc/socket.c:1403
sock_sendmsg_nosec net/socket.c:716 [inline]
__sock_sendmsg net/socket.c:728 [inline]
sock_sendmsg net/socket.c:751 [inline]
kernel_sendmsg+0x213/0x320 net/socket.c:775
sock_no_sendpage+0x14c/0x1c0 net/core/sock.c:3258
kernel_sendpage+0x251/0x2d0 net/socket.c:3596
sock_sendpage+0x85/0xb0 net/socket.c:1079
pipe_to_sendpage+0x257/0x340 fs/splice.c:360
splice_from_pipe_feed fs/splice.c:414 [inline]
__splice_from_pipe+0x334/0x860 fs/splice.c:558
splice_from_pipe fs/splice.c:593 [inline]
generic_splice_sendpage+0x195/0x220 fs/splice.c:742
do_splice_from fs/splice.c:763 [inline]
direct_splice_actor+0xff/0x130 fs/splice.c:930
splice_direct_to_actor+0x4b4/0xbb0 fs/splice.c:885
do_splice_direct+0x27f/0x3c0 fs/splice.c:973
do_sendfile+0x613/0xfe0 fs/read_write.c:1255
__do_sys_sendfile64 fs/read_write.c:1323 [inline]
__se_sys_sendfile64 fs/read_write.c:1309 [inline]
__x64_sys_sendfile64+0x1ce/0x230 fs/read_write.c:1309
x64_sys_call+0x140/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:41
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:0x7f34d4b8d169
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:00007f34d5a12038 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007f34d4da6080 RCX: 00007f34d4b8d169
RDX: 0000000000000000 RSI: 0000000000000003 RDI: 0000000000000004
RBP: 00007f34d4c0e2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 000000008010002b R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f34d4da6080 R15: 00007fff71df6778
Allocated by task 616:
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/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
Freed by task 40:
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_bulk+0x59c/0x780 mm/slub.c:3807
kfree_bulk include/linux/slab.h:475 [inline]
kfree_rcu_work+0x2ae/0x760 kernel/rcu/tree.c:3131
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
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/0xb0 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/0xb0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2
The buggy address belongs to the object at ffff88813a325480
which belongs to the cache kmalloc-96 of size 96
The buggy address is located 0 bytes inside of
96-byte region [ffff88813a325480, ffff88813a3254e0)
The buggy address belongs to the physical page:
page:ffffea0004e8c940 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x13a325
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 ffffea0004275580 dead000000000006 ffff888100042900
raw: 0000000000000000 0000000000200020 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 1640, tgid 1639 (syz.0.568), ts 44220866278, free_ts 44220380352
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
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
__do_kmalloc_node mm/slab_common.c:937 [inline]
__kmalloc+0xa3/0x1e0 mm/slab_common.c:951
kmalloc include/linux/slab.h:568 [inline]
allocate_probes kernel/tracepoint.c:109 [inline]
func_add kernel/tracepoint.c:205 [inline]
tracepoint_add_func+0x26e/0x940 kernel/tracepoint.c:338
tracepoint_probe_register_prio_may_exist+0x11c/0x180 kernel/tracepoint.c:482
tracepoint_probe_register_may_exist include/linux/tracepoint.h:52 [inline]
__bpf_probe_register kernel/trace/bpf_trace.c:2347 [inline]
bpf_probe_register+0x152/0x1e0 kernel/trace/bpf_trace.c:2353
bpf_raw_tp_link_attach+0x456/0x6b0 kernel/bpf/syscall.c:3372
bpf_raw_tracepoint_open+0x22d/0x4a0 kernel/bpf/syscall.c:3399
__sys_bpf+0x4f5/0x7f0 kernel/bpf/syscall.c:5049
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
__vunmap+0x9c6/0xb80 mm/vmalloc.c:2729
__vfree mm/vmalloc.c:2778 [inline]
vfree+0x5c/0x80 mm/vmalloc.c:2809
bpf_check+0x1189e/0x17ed0 kernel/bpf/verifier.c:15687
bpf_prog_load+0x1304/0x1bf0 kernel/bpf/syscall.c:2626
__sys_bpf+0x52c/0x7f0 kernel/bpf/syscall.c:5007
__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/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
Memory state around the buggy address:
ffff88813a325380: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff88813a325400: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff88813a325480: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff88813a325500: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff88813a325580: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================