ntfs3: loop4: Failed to initialize $Extend/$Reparse. ================================================================== BUG: KASAN: slab-use-after-free in ntfs_write_bh+0x6b9/0x6e0 fs/ntfs3/fsntfs.c:1401 Read of size 8 at addr ffff888078a42000 by task syz-executor.4/21800 CPU: 1 PID: 21800 Comm: syz-executor.4 Not tainted 6.6.0-rc1-next-20230915-syzkaller #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_read_ea+0x718/0xa70 fs/ntfs3/xattr.c:179 ntfs_get_ea+0x187/0x6c0 fs/ntfs3/xattr.c:262 ntfs_get_wsl_perm+0xb2/0x380 fs/ntfs3/xattr.c:988 ntfs_read_mft fs/ntfs3/inode.c:381 [inline] ntfs_iget5+0x1618/0x3960 fs/ntfs3/inode.c:532 dir_search_u+0x162/0x3d0 fs/ntfs3/dir.c:264 ntfs_lookup+0x1c5/0x2a0 fs/ntfs3/namei.c:85 __lookup_slow+0x24d/0x450 fs/namei.c:1693 lookup_slow fs/namei.c:1710 [inline] walk_component+0x349/0x5a0 fs/namei.c:2001 lookup_last fs/namei.c:2458 [inline] path_lookupat+0x17f/0x770 fs/namei.c:2482 filename_lookup+0x1e7/0x5b0 fs/namei.c:2511 user_path_at_empty+0x42/0x60 fs/namei.c:2910 user_path_at include/linux/namei.h:57 [inline] do_fchmodat fs/open.c:689 [inline] __do_sys_chmod fs/open.c:715 [inline] __se_sys_chmod fs/open.c:713 [inline] __x64_sys_chmod+0xe8/0x1b0 fs/open.c:713 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fc25aa7cae9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fc25b7400c8 EFLAGS: 00000246 ORIG_RAX: 000000000000005a RAX: ffffffffffffffda RBX: 00007fc25ab9bf80 RCX: 00007fc25aa7cae9 RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000020000000 RBP: 00007fc25aac847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fc25ab9bf80 R15: 00007ffdfe61f5e8 Allocated by task 5276: kasan_save_stack+0x33/0x50 mm/kasan/common.c:46 kasan_set_track+0x25/0x30 mm/kasan/common.c:53 ____kasan_kmalloc mm/kasan/common.c:375 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:384 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] kernfs_iop_get_link fs/kernfs/symlink.c:135 [inline] kernfs_iop_get_link+0x65/0x850 fs/kernfs/symlink.c:126 pick_link fs/namei.c:1805 [inline] step_into+0x1ae9/0x2230 fs/namei.c:1871 open_last_lookups fs/namei.c:3567 [inline] path_openat+0x44a/0x29c0 fs/namei.c:3774 do_filp_open+0x1de/0x430 fs/namei.c:3804 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:51 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 5276: kasan_save_stack+0x33/0x50 mm/kasan/common.c:46 kasan_set_track+0x25/0x30 mm/kasan/common.c:53 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:523 ____kasan_slab_free mm/kasan/common.c:237 [inline] ____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:201 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826 slab_free mm/slub.c:3809 [inline] __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3822 do_delayed_call include/linux/delayed_call.h:28 [inline] put_link fs/namei.c:1025 [inline] open_last_lookups fs/namei.c:3566 [inline] path_openat+0xb25/0x29c0 fs/namei.c:3774 do_filp_open+0x1de/0x430 fs/namei.c:3804 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:51 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888078a42000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 0 bytes inside of freed 4096-byte region [ffff888078a42000, ffff888078a43000) The buggy address belongs to the physical page: page:ffffea0001e29000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x78a40 head:ffffea0001e29000 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888012c42140 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5929, tgid 5927 (syz-executor.2), ts 353044931901, free_ts 352859297619 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1535 prep_new_page mm/page_alloc.c:1542 [inline] get_page_from_freelist+0xdcd/0x2d10 mm/page_alloc.c:3224 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4480 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2298 alloc_slab_page mm/slub.c:1870 [inline] allocate_slab+0x251/0x380 mm/slub.c:2017 new_slab mm/slub.c:2070 [inline] ___slab_alloc+0x8c7/0x1580 mm/slub.c:3223 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322 __slab_alloc_node mm/slub.c:3375 [inline] slab_alloc_node mm/slub.c:3468 [inline] __kmem_cache_alloc_node+0x131/0x340 mm/slub.c:3517 __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_check_open_permission+0x2a3/0x3b0 security/tomoyo/file.c:771 tomoyo_file_open security/tomoyo/tomoyo.c:332 [inline] tomoyo_file_open+0xa8/0xd0 security/tomoyo/tomoyo.c:327 security_file_open+0x6a/0xe0 security/security.c:2836 do_dentry_open+0x538/0x1730 fs/open.c:916 do_open fs/namei.c:3620 [inline] path_openat+0x19af/0x29c0 fs/namei.c:3777 do_filp_open+0x1de/0x430 fs/namei.c:3804 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1138 [inline] free_unref_page+0x554/0xd70 mm/page_alloc.c:2460 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:306 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slub.c:3478 [inline] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc+0x16c/0x3b0 mm/slub.c:3502 kmem_cache_zalloc include/linux/slab.h:710 [inline] alloc_buffer_head+0x21/0x140 fs/buffer.c:3021 folio_alloc_buffers+0x2c8/0x7d0 fs/buffer.c:931 folio_create_empty_buffers+0x36/0x470 fs/buffer.c:1655 ext4_block_write_begin+0xcc4/0xf10 fs/ext4/inode.c:1024 ext4_da_write_begin+0x40a/0x8c0 fs/ext4/inode.c:2890 generic_perform_write+0x278/0x600 mm/filemap.c:3955 ext4_buffered_write_iter+0x11f/0x3c0 fs/ext4/file.c:299 ext4_file_write_iter+0x7f7/0x1860 fs/ext4/file.c:717 __kernel_write_iter+0x261/0x7e0 fs/read_write.c:517 dump_emit_page fs/coredump.c:888 [inline] dump_user_range+0x299/0x790 fs/coredump.c:915 elf_core_dump+0x2700/0x3900 fs/binfmt_elf.c:2142 Memory state around the buggy address: ffff888078a41f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888078a41f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888078a42000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888078a42080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888078a42100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================