================================================================== BUG: KASAN: slab-use-after-free in bq_enqueue kernel/bpf/cpumap.c:710 [inline] BUG: KASAN: slab-use-after-free in cpu_map_enqueue+0xba/0x380 kernel/bpf/cpumap.c:736 Read of size 8 at addr ffff88807bb7aa08 by task syz.3.2234/10995 CPU: 0 PID: 10995 Comm: syz.3.2234 Not tainted 6.10.0-rc6-syzkaller-00175-gf153831097b4 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 bq_enqueue kernel/bpf/cpumap.c:710 [inline] cpu_map_enqueue+0xba/0x380 kernel/bpf/cpumap.c:736 __xdp_do_redirect_frame net/core/filter.c:4406 [inline] xdp_do_redirect_frame+0x35f/0x660 net/core/filter.c:4456 xdp_test_run_batch net/bpf/test_run.c:336 [inline] bpf_test_run_xdp_live+0xe60/0x1e60 net/bpf/test_run.c:384 bpf_prog_test_run_xdp+0x80e/0x11b0 net/bpf/test_run.c:1281 bpf_prog_test_run+0x33a/0x3b0 kernel/bpf/syscall.c:4292 __sys_bpf+0x48d/0x810 kernel/bpf/syscall.c:5706 __do_sys_bpf kernel/bpf/syscall.c:5795 [inline] __se_sys_bpf kernel/bpf/syscall.c:5793 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5793 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fdbdcb75bd9 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:00007fdbdd902048 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007fdbdcd03f60 RCX: 00007fdbdcb75bd9 RDX: 0000000000000050 RSI: 0000000020000240 RDI: 000000000000000a RBP: 00007fdbdcbe4e60 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fdbdcd03f60 R15: 00007ffe03e36218 Allocated by task 10337: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:4123 [inline] __kmalloc_node_noprof+0x22a/0x440 mm/slub.c:4130 kmalloc_node_noprof include/linux/slab.h:681 [inline] bpf_map_kmalloc_node+0xd3/0x1c0 kernel/bpf/syscall.c:422 __cpu_map_entry_alloc kernel/bpf/cpumap.c:402 [inline] cpu_map_update_elem+0x29c/0x1010 kernel/bpf/cpumap.c:556 bpf_map_update_value+0x1b1/0x540 kernel/bpf/syscall.c:169 map_update_elem+0x53a/0x6f0 kernel/bpf/syscall.c:1654 __sys_bpf+0x76f/0x810 kernel/bpf/syscall.c:5676 __do_sys_bpf kernel/bpf/syscall.c:5795 [inline] __se_sys_bpf kernel/bpf/syscall.c:5793 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5793 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 12: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2196 [inline] slab_free mm/slub.c:4438 [inline] kfree+0x149/0x360 mm/slub.c:4559 __cpu_map_entry_free+0x6e8/0x770 kernel/bpf/cpumap.c:492 cpu_map_free+0xc1/0x190 kernel/bpf/cpumap.c:592 bpf_map_free_deferred+0xe6/0x110 kernel/bpf/syscall.c:746 process_one_work kernel/workqueue.c:3248 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3329 worker_thread+0x86d/0xd50 kernel/workqueue.c:3409 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The buggy address belongs to the object at ffff88807bb7aa00 which belongs to the cache kmalloc-cg-256 of size 256 The buggy address is located 8 bytes inside of freed 256-byte region [ffff88807bb7aa00, ffff88807bb7ab00) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807bb7ba00 pfn:0x7bb7a head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff8880281dcb01 ksm flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffefff(slab) raw: 00fff00000000040 ffff88801504f000 ffffea0001870a00 0000000000000003 raw: ffff88807bb7ba00 0000000000100009 00000001ffffefff ffff8880281dcb01 head: 00fff00000000040 ffff88801504f000 ffffea0001870a00 0000000000000003 head: ffff88807bb7ba00 0000000000100009 00000001ffffefff ffff8880281dcb01 head: 00fff00000000001 ffffea0001eede81 ffffffffffffffff 0000000000000000 head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 8393, tgid 8392 (syz.0.1255), ts 156754353024, free_ts 156705968503 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1473 prep_new_page mm/page_alloc.c:1481 [inline] get_page_from_freelist+0x2e4c/0x2f10 mm/page_alloc.c:3425 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4683 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x5f/0x120 mm/slub.c:2265 allocate_slab+0x5a/0x2f0 mm/slub.c:2428 new_slab mm/slub.c:2481 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3667 __slab_alloc+0x58/0xa0 mm/slub.c:3757 __slab_alloc_node mm/slub.c:3810 [inline] slab_alloc_node mm/slub.c:3990 [inline] kmalloc_trace_noprof+0x1d5/0x2c0 mm/slub.c:4149 kmalloc_noprof include/linux/slab.h:660 [inline] kzalloc_noprof include/linux/slab.h:778 [inline] prog_array_map_alloc+0x51/0x200 kernel/bpf/arraymap.c:1135 map_create+0x90c/0x1200 kernel/bpf/syscall.c:1333 __sys_bpf+0x6d1/0x810 kernel/bpf/syscall.c:5670 __do_sys_bpf kernel/bpf/syscall.c:5795 [inline] __se_sys_bpf kernel/bpf/syscall.c:5793 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5793 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 5090 tgid 5090 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1093 [inline] free_unref_page+0xd22/0xea0 mm/page_alloc.c:2588 discard_slab mm/slub.c:2527 [inline] __put_partials+0xeb/0x130 mm/slub.c:2995 put_cpu_partial+0x17c/0x250 mm/slub.c:3070 __slab_free+0x2ea/0x3d0 mm/slub.c:4308 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3940 [inline] slab_alloc_node mm/slub.c:4002 [inline] __do_kmalloc_node mm/slub.c:4122 [inline] __kmalloc_noprof+0x1a3/0x400 mm/slub.c:4136 kmalloc_noprof include/linux/slab.h:664 [inline] tomoyo_realpath_from_path+0xcf/0x5e0 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x2b7/0x740 security/tomoyo/file.c:822 security_inode_getattr+0xd8/0x130 security/security.c:2269 vfs_getattr+0x45/0x430 fs/stat.c:173 vfs_fstat fs/stat.c:198 [inline] vfs_fstatat+0xd6/0x190 fs/stat.c:300 __do_sys_newfstatat fs/stat.c:468 [inline] __se_sys_newfstatat fs/stat.c:462 [inline] __x64_sys_newfstatat+0x125/0x1b0 fs/stat.c:462 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88807bb7a900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807bb7a980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807bb7aa00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807bb7aa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807bb7ab00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================