================================================================== BUG: KASAN: stack-out-of-bounds in bpf_net_ctx_get_all_used_flush_lists include/linux/filter.h:837 [inline] BUG: KASAN: stack-out-of-bounds in xdp_do_check_flushed+0x41c/0x4e0 net/core/filter.c:4298 Read of size 4 at addr ffffc90003defa50 by task syz.3.1468/11203 CPU: 0 UID: 0 PID: 11203 Comm: syz.3.1468 Not tainted 6.10.0-syzkaller-12381-gc33ffdb70cc6 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 bpf_net_ctx_get_all_used_flush_lists include/linux/filter.h:837 [inline] xdp_do_check_flushed+0x41c/0x4e0 net/core/filter.c:4298 __napi_poll.constprop.0+0xd1/0x550 net/core/dev.c:6774 napi_poll net/core/dev.c:6840 [inline] net_rx_action+0xa92/0x1010 net/core/dev.c:6962 handle_softirqs+0x219/0x8f0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:637 [inline] irq_exit_rcu+0xbb/0x120 kernel/softirq.c:649 common_interrupt+0xb0/0xd0 arch/x86/kernel/irq.c:278 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693 RIP: 0010:preempt_count arch/x86/include/asm/preempt.h:26 [inline] RIP: 0010:check_kcov_mode kernel/kcov.c:173 [inline] RIP: 0010:__sanitizer_cov_trace_pc+0xc/0x60 kernel/kcov.c:207 Code: e9 d4 71 a4 09 66 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 65 48 8b 15 e4 0b 78 7e <65> 8b 05 e5 0b 78 7e a9 00 01 ff 00 48 8b 34 24 74 0f f6 c4 01 74 RSP: 0018:ffffc90003def4b8 EFLAGS: 00000202 RAX: 0000000000000002 RBX: ffffc90003def588 RCX: ffffffff813cdd16 RDX: ffff8880262d8000 RSI: 0000000000000000 RDI: 0000000000000005 RBP: ffffc90003def998 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffffc90003def590 R13: ffffc90003def598 R14: ffffc90003de8000 R15: 0000000000000001 on_stack arch/x86/include/asm/stacktrace.h:58 [inline] stack_access_ok+0xa0/0x270 arch/x86/kernel/unwind_orc.c:393 deref_stack_reg arch/x86/kernel/unwind_orc.c:403 [inline] unwind_next_frame+0xd9b/0x23a0 arch/x86/kernel/unwind_orc.c:585 arch_stack_walk+0x100/0x170 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x95/0xd0 kernel/stacktrace.c:122 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:312 [inline] __kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:338 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3988 [inline] slab_alloc_node mm/slub.c:4037 [inline] kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4044 lsm_file_alloc security/security.c:649 [inline] security_file_alloc+0x41/0x260 security/security.c:2736 init_file+0x99/0x260 fs/file_table.c:152 alloc_empty_file+0x91/0x1e0 fs/file_table.c:206 alloc_file fs/file_table.c:319 [inline] alloc_file_pseudo+0x147/0x210 fs/file_table.c:350 __anon_inode_getfile+0x136/0x3e0 fs/anon_inodes.c:109 __anon_inode_getfd fs/anon_inodes.c:234 [inline] anon_inode_getfd+0x52/0xb0 fs/anon_inodes.c:269 bpf_map_new_fd kernel/bpf/syscall.c:1021 [inline] bpf_map_new_fd kernel/bpf/syscall.c:1013 [inline] map_create+0xce0/0x1c50 kernel/bpf/syscall.c:1397 __sys_bpf+0xd73/0x4a30 kernel/bpf/syscall.c:5692 __do_sys_bpf kernel/bpf/syscall.c:5817 [inline] __se_sys_bpf kernel/bpf/syscall.c:5815 [inline] __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5815 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff839175f19 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:00007ff838bff048 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007ff839305f60 RCX: 00007ff839175f19 RDX: 0000000000000048 RSI: 00000000200000c0 RDI: 0000000000000000 RBP: 00007ff8391e4e68 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007ff839305f60 R15: 00007ffe20958608 The buggy address belongs to stack of task syz.3.1468/11203 and is located at offset 88 in frame: alloc_file_pseudo+0x0/0x210 include/linux/percpu_counter.h:71 This frame has 2 objects: [32, 48) 'path' [64, 80) 'this' The buggy address belongs to the virtual mapping at [ffffc90003de8000, ffffc90003df1000) created by: kernel_clone+0xfd/0x980 kernel/fork.c:2781 The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880593aa960 pfn:0x593aa memcg:ffff88801a701702 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000 raw: ffff8880593aa960 0000000000000000 00000001ffffffff ffff88801a701702 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 962, tgid 962 (kworker/u8:6), ts 853729378484, free_ts 852956913794 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1493 prep_new_page mm/page_alloc.c:1501 [inline] get_page_from_freelist+0x1351/0x2e50 mm/page_alloc.c:3438 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4696 alloc_pages_mpol_noprof+0x275/0x610 mm/mempolicy.c:2263 vm_area_alloc_pages mm/vmalloc.c:3584 [inline] __vmalloc_area_node mm/vmalloc.c:3660 [inline] __vmalloc_node_range_noprof+0xa6a/0x1520 mm/vmalloc.c:3841 alloc_thread_stack_node kernel/fork.c:313 [inline] dup_task_struct kernel/fork.c:1113 [inline] copy_process+0x2f3b/0x8de0 kernel/fork.c:2204 kernel_clone+0xfd/0x980 kernel/fork.c:2781 user_mode_thread+0xb4/0xf0 kernel/fork.c:2859 call_usermodehelper_exec_sync kernel/umh.c:133 [inline] call_usermodehelper_exec_work+0x6b/0x170 kernel/umh.c:164 process_one_work+0x9c8/0x1b40 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xf20 kernel/workqueue.c:3390 kthread+0x2c4/0x3a0 kernel/kthread.c:389 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 page last free pid 11007 tgid 11007 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1094 [inline] free_unref_page+0x64a/0xe40 mm/page_alloc.c:2608 mon_free_buff drivers/usb/mon/mon_bin.c:1360 [inline] mon_bin_release+0x160/0x240 drivers/usb/mon/mon_bin.c:795 __fput+0x40b/0xbb0 fs/file_table.c:422 task_work_run+0x151/0x250 kernel/task_work.c:222 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x27b/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffffc90003def900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffc90003def980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 >ffffc90003defa00: f1 f1 f1 00 00 f2 f2 00 00 f3 f3 00 00 00 00 00 ^ ffffc90003defa80: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 ffffc90003defb00: f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== BUG: unable to handle page fault for address: ffffffff00000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD db80067 P4D db80067 PUD 0 Oops: Oops: 0000 [#1] PREEMPT SMP KASAN NOPTI CPU: 0 UID: 0 PID: 11203 Comm: syz.3.1468 Tainted: G B 6.10.0-syzkaller-12381-gc33ffdb70cc6 #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 RIP: 0010:__dev_flush+0x53/0x1e0 kernel/bpf/devmap.c:424 Code: 02 00 0f 85 98 01 00 00 48 b8 00 00 00 00 00 fc ff df 49 8b 2f 48 8d 5d 80 48 89 ea 48 c1 ea 03 80 3c 02 00 0f 85 69 01 00 00 <48> 8b 45 00 49 39 ef 4c 8d 60 80 0f 84 03 01 00 00 48 bd 00 00 00 RSP: 0018:ffffc90000007c80 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: fffffffeffffff80 RCX: ffffffff88f9b189 RDX: 1fffffffe0000000 RSI: ffffffff81b12466 RDI: ffffc90003defa68 RBP: ffffffff00000000 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 6e696c6261736944 R12: ffffc90003defa58 R13: ffff888022250008 R14: ffffc90003defa68 R15: ffffc90003defa68 FS: 00007ff838bff6c0(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffff00000000 CR3: 000000005c17a000 CR4: 0000000000350ef0 Call Trace: xdp_do_check_flushed+0x2f2/0x4e0 net/core/filter.c:4300 __napi_poll.constprop.0+0xd1/0x550 net/core/dev.c:6774 napi_poll net/core/dev.c:6840 [inline] net_rx_action+0xa92/0x1010 net/core/dev.c:6962 handle_softirqs+0x219/0x8f0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:637 [inline] irq_exit_rcu+0xbb/0x120 kernel/softirq.c:649 common_interrupt+0xb0/0xd0 arch/x86/kernel/irq.c:278 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693 RIP: 0010:preempt_count arch/x86/include/asm/preempt.h:26 [inline] RIP: 0010:check_kcov_mode kernel/kcov.c:173 [inline] RIP: 0010:__sanitizer_cov_trace_pc+0xc/0x60 kernel/kcov.c:207 Code: e9 d4 71 a4 09 66 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 65 48 8b 15 e4 0b 78 7e <65> 8b 05 e5 0b 78 7e a9 00 01 ff 00 48 8b 34 24 74 0f f6 c4 01 74 RSP: 0018:ffffc90003def4b8 EFLAGS: 00000202 RAX: 0000000000000002 RBX: ffffc90003def588 RCX: ffffffff813cdd16 RDX: ffff8880262d8000 RSI: 0000000000000000 RDI: 0000000000000005 RBP: ffffc90003def998 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffffc90003def590 R13: ffffc90003def598 R14: ffffc90003de8000 R15: 0000000000000001 on_stack arch/x86/include/asm/stacktrace.h:58 [inline] stack_access_ok+0xa0/0x270 arch/x86/kernel/unwind_orc.c:393 deref_stack_reg arch/x86/kernel/unwind_orc.c:403 [inline] unwind_next_frame+0xd9b/0x23a0 arch/x86/kernel/unwind_orc.c:585 arch_stack_walk+0x100/0x170 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x95/0xd0 kernel/stacktrace.c:122 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:312 [inline] __kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:338 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3988 [inline] slab_alloc_node mm/slub.c:4037 [inline] kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4044 lsm_file_alloc security/security.c:649 [inline] security_file_alloc+0x41/0x260 security/security.c:2736 init_file+0x99/0x260 fs/file_table.c:152 alloc_empty_file+0x91/0x1e0 fs/file_table.c:206 alloc_file fs/file_table.c:319 [inline] alloc_file_pseudo+0x147/0x210 fs/file_table.c:350 __anon_inode_getfile+0x136/0x3e0 fs/anon_inodes.c:109 __anon_inode_getfd fs/anon_inodes.c:234 [inline] anon_inode_getfd+0x52/0xb0 fs/anon_inodes.c:269 bpf_map_new_fd kernel/bpf/syscall.c:1021 [inline] bpf_map_new_fd kernel/bpf/syscall.c:1013 [inline] map_create+0xce0/0x1c50 kernel/bpf/syscall.c:1397 __sys_bpf+0xd73/0x4a30 kernel/bpf/syscall.c:5692 __do_sys_bpf kernel/bpf/syscall.c:5817 [inline] __se_sys_bpf kernel/bpf/syscall.c:5815 [inline] __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5815 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff839175f19 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:00007ff838bff048 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007ff839305f60 RCX: 00007ff839175f19 RDX: 0000000000000048 RSI: 00000000200000c0 RDI: 0000000000000000 RBP: 00007ff8391e4e68 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007ff839305f60 R15: 00007ffe20958608 Modules linked in: CR2: ffffffff00000000 ---[ end trace 0000000000000000 ]--- RIP: 0010:__dev_flush+0x53/0x1e0 kernel/bpf/devmap.c:424 Code: 02 00 0f 85 98 01 00 00 48 b8 00 00 00 00 00 fc ff df 49 8b 2f 48 8d 5d 80 48 89 ea 48 c1 ea 03 80 3c 02 00 0f 85 69 01 00 00 <48> 8b 45 00 49 39 ef 4c 8d 60 80 0f 84 03 01 00 00 48 bd 00 00 00 RSP: 0018:ffffc90000007c80 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: fffffffeffffff80 RCX: ffffffff88f9b189 RDX: 1fffffffe0000000 RSI: ffffffff81b12466 RDI: ffffc90003defa68 RBP: ffffffff00000000 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 6e696c6261736944 R12: ffffc90003defa58 R13: ffff888022250008 R14: ffffc90003defa68 R15: ffffc90003defa68 FS: 00007ff838bff6c0(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffff00000000 CR3: 000000005c17a000 CR4: 0000000000350ef0 ---------------- Code disassembly (best guess): 0: e9 d4 71 a4 09 jmp 0x9a471d9 5: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1) c: 00 00 e: 90 nop f: 90 nop 10: 90 nop 11: 90 nop 12: 90 nop 13: 90 nop 14: 90 nop 15: 90 nop 16: 90 nop 17: 90 nop 18: 90 nop 19: 90 nop 1a: 90 nop 1b: 90 nop 1c: 90 nop 1d: 90 nop 1e: f3 0f 1e fa endbr64 22: 65 48 8b 15 e4 0b 78 mov %gs:0x7e780be4(%rip),%rdx # 0x7e780c0e 29: 7e * 2a: 65 8b 05 e5 0b 78 7e mov %gs:0x7e780be5(%rip),%eax # 0x7e780c16 <-- trapping instruction 31: a9 00 01 ff 00 test $0xff0100,%eax 36: 48 8b 34 24 mov (%rsp),%rsi 3a: 74 0f je 0x4b 3c: f6 c4 01 test $0x1,%ah 3f: 74 .byte 0x74