loop3: detected capacity change from 0 to 4096 ntfs3: loop3: Primary boot: invalid bytes per index 3072(3). ntfs3: loop3: Mark volume as dirty due to NTFS errors ================================================================== BUG: KASAN: use-after-free in ntfs_write_bh+0x6b9/0x6e0 fs/ntfs3/fsntfs.c:1401 Read of size 8 at addr ffff88803fd50000 by task syz-executor.3/27741 CPU: 0 PID: 27741 Comm: syz-executor.3 Not tainted 6.6.0-rc2-syzkaller-00018-g2cf0f7156238 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 ntfs_write_bh+0x6b9/0x6e0 fs/ntfs3/fsntfs.c:1401 mi_write+0xc0/0x1e0 fs/ntfs3/record.c:346 ni_write_inode+0x102c/0x2810 fs/ntfs3/frecord.c:3360 write_inode fs/fs-writeback.c:1456 [inline] __writeback_single_inode+0xa81/0xe70 fs/fs-writeback.c:1668 writeback_single_inode+0x2af/0x590 fs/fs-writeback.c:1724 sync_inode_metadata+0xa5/0xe0 fs/fs-writeback.c:2786 ntfs_set_state+0x3f0/0x6e0 fs/ntfs3/fsntfs.c:995 ntfs_iget5+0x918/0x3960 fs/ntfs3/inode.c:539 ntfs_fill_super+0x24a6/0x4330 fs/ntfs3/super.c:1198 get_tree_bdev+0x3b5/0x650 fs/super.c:1577 vfs_get_tree+0x8c/0x370 fs/super.c:1750 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f1d28a7e1ea 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:00007f1d298aeee8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f1d298aef80 RCX: 00007f1d28a7e1ea RDX: 0000000020000040 RSI: 000000002001f780 RDI: 00007f1d298aef40 RBP: 0000000020000040 R08: 00007f1d298aef80 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000202 R12: 000000002001f780 R13: 00007f1d298aef40 R14: 000000000001f75a R15: 0000000020000080 The buggy address belongs to the physical page: page:ffffea0000ff5400 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x0 pfn:0x3fd50 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffff7f(buddy) raw: 00fff00000000000 ffffea0002086008 ffffea0001d31708 0000000000000000 raw: 0000000000000000 0000000000000002 00000000ffffff7f 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 1, migratetype Unmovable, gfp_mask 0x342040(__GFP_IO|__GFP_NOWARN|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 11414, tgid 11414 (udevd), ts 2855450315335, free_ts 2868756408496 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1356 [inline] cache_grow_begin+0x99/0x3a0 mm/slab.c:2550 cache_alloc_refill+0x294/0x3a0 mm/slab.c:2923 ____cache_alloc mm/slab.c:2999 [inline] ____cache_alloc mm/slab.c:2982 [inline] __do_cache_alloc mm/slab.c:3182 [inline] slab_alloc_node mm/slab.c:3230 [inline] __kmem_cache_alloc_node+0x3c5/0x470 mm/slab.c:3521 __do_kmalloc_node mm/slab_common.c:1022 [inline] __kmalloc+0x4f/0x100 mm/slab_common.c:1036 kmalloc include/linux/slab.h:603 [inline] tomoyo_realpath_from_path+0xb9/0x710 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x26f/0x450 security/tomoyo/file.c:822 security_inode_getattr+0xf1/0x150 security/security.c:2153 vfs_getattr fs/stat.c:206 [inline] vfs_statx+0x180/0x430 fs/stat.c:281 vfs_fstatat+0xb3/0x140 fs/stat.c:332 __do_sys_newfstatat+0x98/0x110 fs/stat.c:496 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/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:1136 [inline] free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405 slab_destroy mm/slab.c:1608 [inline] slabs_destroy+0x85/0xc0 mm/slab.c:1628 cache_flusharray mm/slab.c:3341 [inline] ___cache_free+0x2b7/0x420 mm/slab.c:3404 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x4c/0x1b0 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slab.c:3237 [inline] __kmem_cache_alloc_node+0x163/0x470 mm/slab.c:3521 kmalloc_trace+0x25/0xe0 mm/slab_common.c:1114 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] kernfs_fop_open+0x318/0xe00 fs/kernfs/file.c:670 do_dentry_open+0x88b/0x1730 fs/open.c:929 do_open fs/namei.c:3639 [inline] path_openat+0x19af/0x29c0 fs/namei.c:3796 do_filp_open+0x1de/0x430 fs/namei.c:3823 do_sys_openat2+0x176/0x1e0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_openat fs/open.c:1453 [inline] __se_sys_openat fs/open.c:1448 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1448 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 Memory state around the buggy address: ffff88803fd4ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88803fd4ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88803fd50000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88803fd50080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88803fd50100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================