================================================================== 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:4305 Read of size 4 at addr ffffc90021aafa40 by task syz.0.492/6866 CPU: 1 UID: 0 PID: 6866 Comm: syz.0.492 Not tainted 6.11.0-rc1-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 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:4305 __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+0x216/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 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0x95/0xb0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:__sanitizer_cov_trace_cmp8+0xe/0x20 kernel/kcov.c:284 Code: ff ff 66 2e 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 48 8b 0c 24 48 89 f2 48 89 fe 06 00 00 00 e9 b8 fe ff ff 0f 1f 84 00 00 00 00 00 90 90 90 90 RSP: 0018:ffffc90021aae720 EFLAGS: 00000246 RAX: 0000000000040000 RBX: ffffc90021aae7a8 RCX: ffffffff813c7fee RDX: ffffffff81000000 RSI: ffffffff81f8ebff RDI: ffffffff81f8ebff RBP: 0000000000000001 R08: 0000000000000007 R09: 0000000000000000 R10: ffffffff81f8ebff R11: dffffc0000000000 R12: ffffffff81f8ebff R13: 0000000000000000 R14: ffffc90021aae868 R15: ffffc90021aae7dd orc_find arch/x86/kernel/unwind_orc.c:206 [inline] unwind_next_frame+0x1de/0x23a0 arch/x86/kernel/unwind_orc.c:494 arch_stack_walk+0x100/0x170 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x95/0xd0 kernel/stacktrace.c:122 save_stack+0x162/0x1f0 mm/page_owner.c:156 __set_page_owner+0x8f/0x790 mm/page_owner.c:320 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:3442 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4700 alloc_pages_mpol_noprof+0x275/0x610 mm/mempolicy.c:2263 folio_alloc_mpol_noprof+0x36/0xd0 mm/mempolicy.c:2281 shmem_alloc_folio+0x135/0x160 mm/shmem.c:1726 shmem_alloc_and_add_folio+0x198/0xcd0 mm/shmem.c:1786 shmem_get_folio_gfp+0xa62/0x15e0 mm/shmem.c:2192 shmem_get_folio mm/shmem.c:2297 [inline] shmem_write_begin+0x15a/0x360 mm/shmem.c:2902 generic_perform_write+0x312/0xaa0 mm/filemap.c:4019 shmem_file_write_iter+0x114/0x140 mm/shmem.c:3078 __kernel_write_iter+0x310/0xa80 fs/read_write.c:523 dump_emit_page fs/coredump.c:893 [inline] dump_user_range+0x389/0x8a0 fs/coredump.c:954 elf_core_dump+0x2b4c/0x3d80 fs/binfmt_elf.c:2116 do_coredump+0x29f9/0x3dd0 fs/coredump.c:767 get_signal+0x237e/0x26e0 kernel/signal.c:2902 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:310 exit_to_user_mode_loop kernel/entry/common.c:111 [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+0x150/0x2a0 kernel/entry/common.c:218 __do_fast_syscall_32+0x80/0x120 arch/x86/entry/common.c:389 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7fb2579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f576662c EFLAGS: 00000246 ORIG_RAX: 00000000000000f0 RAX: ffffffffffffffda RBX: 00000000f7474f8c RCX: 0000000000000081 RDX: 00000000000f4240 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 00000000f71952a9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 The buggy address belongs to stack of task syz.0.492/6866 and is located at offset 0 in frame: do_coredump+0x0/0x3dd0 fs/coredump.c:819 This frame has 7 objects: [32, 48) 'cn' [64, 80) 'root' [96, 136) '__wq_entry' [176, 240) 'vmi' [272, 360) 'cprm' [400, 512) 'core_state' [544, 548) 'elfmag' The buggy address belongs to the virtual mapping at [ffffc90021aa8000, ffffc90021ab1000) 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:0xffff8880129d0300 pfn:0x129d0 memcg:ffff888056dafb02 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000 raw: ffff8880129d0300 0000000000000000 00000001ffffffff ffff888056dafb02 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 6810, tgid 6810 (syz.2.476), ts 121610001864, free_ts 121568175477 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:3442 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4700 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+0x29f5/0x6f50 kernel/fork.c:2204 kernel_clone+0xfd/0x980 kernel/fork.c:2781 __do_sys_clone3+0x1f5/0x270 kernel/fork.c:3085 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] do_int80_emulation+0x104/0x200 arch/x86/entry/common.c:253 asm_int80_emulation+0x1a/0x20 arch/x86/include/asm/idtentry.h:626 page last free pid 4834 tgid 4834 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:2612 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322 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] __do_kmalloc_node mm/slub.c:4157 [inline] __kmalloc_noprof+0x199/0x410 mm/slub.c:4170 kmalloc_noprof include/linux/slab.h:685 [inline] tomoyo_realpath_from_path+0xbf/0x710 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x273/0x480 security/tomoyo/file.c:822 security_inode_getattr+0xf4/0x160 security/security.c:2269 vfs_getattr fs/stat.c:204 [inline] vfs_fstat+0x53/0xd0 fs/stat.c:229 vfs_fstatat+0x146/0x160 fs/stat.c:338 __do_sys_newfstatat+0xa2/0x130 fs/stat.c:505 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 Memory state around the buggy address: ffffc90021aaf900: 00 f3 f3 f3 f3 f3 f3 f3 f3 f3 00 00 00 00 00 00 ffffc90021aaf980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffffc90021aafa00: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 f2 f2 ^ ffffc90021aafa80: 00 00 f2 f2 00 00 00 00 00 f2 f2 f2 f2 f2 00 00 ffffc90021aafb00: 00 00 00 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 ================================================================== ---------------- Code disassembly (best guess), 1 bytes skipped: 0: ff 66 2e jmp *0x2e(%rsi) 3: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1) a: 00 b: 90 nop c: 90 nop d: 90 nop 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: f3 0f 1e fa endbr64 1f: 48 8b 0c 24 mov (%rsp),%rcx 23: 48 89 f2 mov %rsi,%rdx 26: 48 89 fe mov %rdi,%rsi * 29: bf 06 00 00 00 mov $0x6,%edi <-- trapping instruction 2e: e9 b8 fe ff ff jmp 0xfffffeeb 33: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1) 3a: 00 3b: 90 nop 3c: 90 nop 3d: 90 nop 3e: 90 nop