================================================================== BUG: KASAN: stack-out-of-bounds in collapse_file+0x4edf/0x5830 mm/khugepaged.c:2038 Read of size 8 at addr ffffc90004db7908 by task syz-executor.3/6933 CPU: 1 PID: 6933 Comm: syz-executor.3 Not tainted 6.1.0-rc4-next-20221111-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+0xcd/0x134 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+0x4edf/0x5830 mm/khugepaged.c:2038 hpage_collapse_scan_file+0xdba/0x18e0 mm/khugepaged.c:2237 madvise_collapse+0x521/0xb30 mm/khugepaged.c:2696 madvise_vma_behavior+0x6f6/0x1db0 mm/madvise.c:1089 madvise_walk_vmas+0x1c7/0x2b0 mm/madvise.c:1263 do_madvise.part.0+0x24a/0x340 mm/madvise.c:1442 do_madvise mm/madvise.c:1455 [inline] __do_sys_madvise mm/madvise.c:1455 [inline] __se_sys_madvise mm/madvise.c:1453 [inline] __x64_sys_madvise+0x113/0x150 mm/madvise.c:1453 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:0x7f1b3168b639 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:00007f1b3230d168 EFLAGS: 00000246 ORIG_RAX: 000000000000001c RAX: ffffffffffffffda RBX: 00007f1b317ac050 RCX: 00007f1b3168b639 RDX: 0000000000000019 RSI: 0000000000600003 RDI: 0000000020000000 RBP: 00007f1b316e67e1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc6a5fde2f R14: 00007f1b3230d300 R15: 0000000000022000 The buggy address belongs to stack of task syz-executor.3/6933 and is located at offset 120 in frame: collapse_file+0x0/0x5830 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 [ffffc90004db0000, ffffc90004db9000) created by: kernel_clone+0xe7/0x980 kernel/fork.c:2681 The buggy address belongs to the physical page: page:ffffea0000a892c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2a24b memcg:ffff88801b76d482 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000000 00000001ffffffff ffff88801b76d482 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 5288, tgid 5288 (syz-executor.3), ts 435824215304, free_ts 435783882032 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:5569 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2285 vm_area_alloc_pages mm/vmalloc.c:2989 [inline] __vmalloc_area_node mm/vmalloc.c:3057 [inline] __vmalloc_node_range+0x971/0x13b0 mm/vmalloc.c:3227 alloc_thread_stack_node kernel/fork.c:311 [inline] dup_task_struct kernel/fork.c:987 [inline] copy_process+0x12d2/0x7520 kernel/fork.c:2097 kernel_clone+0xe7/0x980 kernel/fork.c:2681 __do_sys_clone+0xba/0x100 kernel/fork.c:2822 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+0x19/0x4d0 mm/page_alloc.c:3505 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2578 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x18e/0x220 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x62/0x80 mm/kasan/common.c:307 kasan_slab_alloc include/linux/kasan.h:202 [inline] slab_post_alloc_hook mm/slab.h:747 [inline] slab_alloc_node mm/slub.c:3390 [inline] kmem_cache_alloc_node+0x2fc/0x400 mm/slub.c:3435 __alloc_skb+0x212/0x310 net/core/skbuff.c:498 alloc_skb_fclone include/linux/skbuff.h:1317 [inline] tcp_stream_alloc_skb+0x38/0x580 net/ipv4/tcp.c:862 tcp_sendmsg_locked+0xc4b/0x2960 net/ipv4/tcp.c:1325 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1483 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:827 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 sock_write_iter+0x291/0x3d0 net/socket.c:1108 call_write_iter include/linux/fs.h:2159 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x9e9/0xdd0 fs/read_write.c:584 ksys_write+0x1e8/0x250 fs/read_write.c:637 Memory state around the buggy address: ffffc90004db7800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffc90004db7880: 00 00 f1 f1 f1 f1 00 f2 f2 f2 00 f2 f2 f2 00 00 >ffffc90004db7900: f2 f2 00 00 00 00 00 00 00 f3 f3 f3 f3 f3 00 00 ^ ffffc90004db7980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffc90004db7a00: 00 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00 00 00 ==================================================================