================================================================== BUG: KASAN: stack-out-of-bounds in collapse_file+0x3543/0x3f00 mm/khugepaged.c:2038 Read of size 8 at addr ffffc90004dd7910 by task syz-executor.0/4151 CPU: 1 PID: 4151 Comm: syz-executor.0 Not tainted 6.1.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x57/0x7d lib/dump_stack.c:106 print_address_description mm/kasan/report.c:253 [inline] print_report+0x15e/0x45d mm/kasan/report.c:364 kasan_report+0xbb/0x1f0 mm/kasan/report.c:464 collapse_file+0x3543/0x3f00 mm/khugepaged.c:2038 hpage_collapse_scan_file+0x97c/0x1190 mm/khugepaged.c:2237 madvise_collapse+0x43b/0x920 mm/khugepaged.c:2696 madvise_vma_behavior+0x5af/0x1670 mm/madvise.c:1073 madvise_walk_vmas+0x155/0x230 mm/madvise.c:1247 do_madvise.part.0+0x1c3/0x280 mm/madvise.c:1426 do_madvise mm/madvise.c:1439 [inline] __do_sys_madvise mm/madvise.c:1439 [inline] __se_sys_madvise mm/madvise.c:1437 [inline] __x64_sys_madvise+0xcc/0x130 mm/madvise.c:1437 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f5b0688b639 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f5b07539168 EFLAGS: 00000246 ORIG_RAX: 000000000000001c RAX: ffffffffffffffda RBX: 00007f5b069abf80 RCX: 00007f5b0688b639 RDX: 0000000000000019 RSI: 0000000000600003 RDI: 0000000020000000 RBP: 00007f5b068e67e1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffdb99226cf R14: 00007f5b07539300 R15: 0000000000022000 The buggy address belongs to stack of task syz-executor.0/4151 and is located at offset 120 in frame: collapse_file+0x0/0x3f00 arch/x86/include/asm/bitops.h:207 This frame has 4 objects: [32, 40) 'hpage' [64, 72) 'folio' [96, 112) 'pagelist' [128, 184) 'xas' The buggy address belongs to the virtual mapping at [ffffc90004dd0000, ffffc90004dd9000) created by: kernel_clone+0xb8/0x710 kernel/fork.c:2690 The buggy address belongs to the physical page: page:ffffea0001f03980 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7c0e6 memcg:ffff888145f32b82 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000000 00000001ffffffff ffff888145f32b82 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 4082, tgid 4082 (dhcpcd-run-hook), ts 68009043381, free_ts 68007595626 prep_new_page mm/page_alloc.c:2561 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4310 __alloc_pages+0x1c7/0x5a0 mm/page_alloc.c:5577 vm_area_alloc_pages mm/vmalloc.c:2989 [inline] __vmalloc_area_node mm/vmalloc.c:3057 [inline] __vmalloc_node_range+0x70e/0x1010 mm/vmalloc.c:3227 alloc_thread_stack_node kernel/fork.c:311 [inline] dup_task_struct kernel/fork.c:984 [inline] copy_process+0x52d/0x6810 kernel/fork.c:2103 kernel_clone+0xb8/0x710 kernel/fork.c:2690 __do_sys_clone+0xa1/0xe0 kernel/fork.c:2831 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1468 [inline] free_pcp_prepare+0x65c/0xc00 mm/page_alloc.c:1518 free_unref_page_prepare mm/page_alloc.c:3409 [inline] free_unref_page_list+0x172/0xc40 mm/page_alloc.c:3551 release_pages+0x24f/0xef0 mm/swap.c:1066 tlb_batch_pages_flush+0x85/0x160 mm/mmu_gather.c:59 tlb_flush_mmu_free mm/mmu_gather.c:256 [inline] tlb_flush_mmu mm/mmu_gather.c:263 [inline] tlb_finish_mmu+0x110/0x6c0 mm/mmu_gather.c:363 exit_mmap+0x1c9/0x610 mm/mmap.c:3105 __mmput+0xf3/0x440 kernel/fork.c:1204 exit_mm kernel/exit.c:516 [inline] do_exit+0x86f/0x2410 kernel/exit.c:807 do_group_exit+0xb0/0x250 kernel/exit.c:950 __do_sys_exit_group kernel/exit.c:961 [inline] __se_sys_exit_group kernel/exit.c:959 [inline] __x64_sys_exit_group+0x35/0x40 kernel/exit.c:959 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffffc90004dd7800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffc90004dd7880: 00 00 00 f1 f1 f1 f1 00 f2 f2 f2 00 f2 f2 f2 00 >ffffc90004dd7900: 00 f2 f2 00 00 00 00 00 00 00 f3 f3 f3 f3 f3 00 ^ ffffc90004dd7980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffc90004dd7a00: 00 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00 00 00 ==================================================================