loop2: detected capacity change from 0 to 4096 ================================================================== BUG: KASAN: use-after-free in ntfs_read_folio+0x9b0/0x29d0 fs/ntfs/aops.c:489 Write of size 4097 at addr ffff88808d199000 by task syz-executor.2/4862 CPU: 0 PID: 4862 Comm: syz-executor.2 Not tainted 6.1.43-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15f/0x4f0 mm/kasan/report.c:395 kasan_report+0x136/0x160 mm/kasan/report.c:495 kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189 memcpy+0x3c/0x60 mm/kasan/shadow.c:66 ntfs_read_folio+0x9b0/0x29d0 fs/ntfs/aops.c:489 filemap_read_folio+0x199/0x780 mm/filemap.c:2407 do_read_cache_folio+0x2ee/0x810 mm/filemap.c:3535 do_read_cache_page+0x32/0x220 mm/filemap.c:3577 read_mapping_page include/linux/pagemap.h:756 [inline] ntfs_map_page fs/ntfs/aops.h:75 [inline] check_mft_mirror fs/ntfs/super.c:1109 [inline] load_system_files+0x560/0x4830 fs/ntfs/super.c:1772 ntfs_fill_super+0x19b0/0x2bd0 fs/ntfs/super.c:2892 mount_bdev+0x2c9/0x3f0 fs/super.c:1423 legacy_get_tree+0xeb/0x180 fs/fs_context.c:611 vfs_get_tree+0x88/0x270 fs/super.c:1553 do_new_mount+0x28b/0xae0 fs/namespace.c:3040 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f1671c7e1ea Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 09 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f1672ac0ee8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f1672ac0f80 RCX: 00007f1671c7e1ea RDX: 000000002001f6c0 RSI: 000000002001f640 RDI: 00007f1672ac0f40 RBP: 000000002001f6c0 R08: 00007f1672ac0f80 R09: 0000000000008703 R10: 0000000000008703 R11: 0000000000000202 R12: 000000002001f640 R13: 00007f1672ac0f40 R14: 000000000001f656 R15: 0000000020000000 The buggy address belongs to the physical page: page:ffffea0002346640 refcount:3 mapcount:0 mapping:ffff8880966a7088 index:0x0 pfn:0x8d199 memcg:ffff888020394000 aops:ntfs_mst_aops ino:1 flags: 0xfff00000000001(locked|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000001 0000000000000000 dead000000000122 ffff8880966a7088 raw: 0000000000000000 0000000000000000 00000003ffffffff ffff888020394000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 4862, tgid 4861 (syz-executor.2), ts 1740467511009, free_ts 1740038185382 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2533 prep_new_page mm/page_alloc.c:2540 [inline] get_page_from_freelist+0x32ed/0x3480 mm/page_alloc.c:4292 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5559 folio_alloc+0x1a/0x50 mm/mempolicy.c:2290 filemap_alloc_folio+0xda/0x4f0 mm/filemap.c:971 do_read_cache_folio+0x2a7/0x810 mm/filemap.c:3499 do_read_cache_page+0x32/0x220 mm/filemap.c:3577 read_mapping_page include/linux/pagemap.h:756 [inline] ntfs_map_page fs/ntfs/aops.h:75 [inline] check_mft_mirror fs/ntfs/super.c:1109 [inline] load_system_files+0x560/0x4830 fs/ntfs/super.c:1772 ntfs_fill_super+0x19b0/0x2bd0 fs/ntfs/super.c:2892 mount_bdev+0x2c9/0x3f0 fs/super.c:1423 legacy_get_tree+0xeb/0x180 fs/fs_context.c:611 vfs_get_tree+0x88/0x270 fs/super.c:1553 do_new_mount+0x28b/0xae0 fs/namespace.c:3040 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/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:1460 [inline] free_pcp_prepare mm/page_alloc.c:1510 [inline] free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3388 free_unref_page_list+0x107/0x810 mm/page_alloc.c:3530 release_pages+0x2836/0x2b40 mm/swap.c:1055 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline] tlb_flush_mmu_free mm/mmu_gather.c:254 [inline] tlb_flush_mmu+0xfc/0x210 mm/mmu_gather.c:261 zap_pte_range mm/memory.c:1515 [inline] zap_pmd_range mm/memory.c:1564 [inline] zap_pud_range mm/memory.c:1593 [inline] zap_p4d_range mm/memory.c:1614 [inline] unmap_page_range+0x217c/0x2740 mm/memory.c:1635 unmap_vmas+0x3c4/0x560 mm/memory.c:1720 exit_mmap+0x252/0x9f0 mm/mmap.c:3214 __mmput+0x115/0x3c0 kernel/fork.c:1191 exit_mm+0x226/0x300 kernel/exit.c:563 do_exit+0x67e/0x2300 kernel/exit.c:856 do_group_exit+0x202/0x2b0 kernel/exit.c:1019 get_signal+0x16f7/0x17d0 kernel/signal.c:2862 arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:168 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:297 Memory state around the buggy address: ffff88808d199f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88808d199f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88808d19a000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88808d19a080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88808d19a100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================