loop5: detected capacity change from 0 to 4096 ================================================================== BUG: KASAN: slab-use-after-free in ntfs_write_bh+0x6b9/0x6e0 fs/ntfs3/fsntfs.c:1401 Read of size 8 at addr ffff888034656000 by task syz-executor.5/22013 CPU: 1 PID: 22013 Comm: syz-executor.5 Not tainted 6.6.0-rc1-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_create_inode+0x317/0x4290 fs/ntfs3/inode.c:1307 ntfs_atomic_open+0x4d2/0x650 fs/ntfs3/namei.c:422 atomic_open fs/namei.c:3358 [inline] lookup_open.isra.0+0xc44/0x1360 fs/namei.c:3466 open_last_lookups fs/namei.c:3563 [inline] path_openat+0x931/0x29c0 fs/namei.c:3793 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_open fs/open.c:1445 [inline] __se_sys_open fs/open.c:1441 [inline] __x64_sys_open+0x154/0x1e0 fs/open.c:1441 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:0x7f541527cae9 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:00007f5415ff60c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007f541539bf80 RCX: 00007f541527cae9 RDX: 0000000000000000 RSI: 0000000000060142 RDI: 0000000020000000 RBP: 00007f54152c847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f541539bf80 R15: 00007ffdc347fc48 Allocated by task 4491: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x81/0x90 mm/kasan/common.c:328 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+0x172/0x3b0 mm/slub.c:3502 getname_flags.part.0+0x50/0x4d0 fs/namei.c:140 getname_flags+0x9c/0xf0 include/linux/audit.h:321 vfs_fstatat+0x9a/0x140 fs/stat.c:331 __do_sys_newfstatat+0x98/0x110 fs/stat.c:502 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 Freed by task 4491: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:200 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+0xf0/0x480 mm/slub.c:3831 putname fs/namei.c:273 [inline] putname+0x101/0x140 fs/namei.c:259 vfs_fstatat+0xbd/0x140 fs/stat.c:333 __do_sys_newfstatat+0x98/0x110 fs/stat.c:502 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 The buggy address belongs to the object at ffff888034655500 which belongs to the cache names_cache of size 4096 The buggy address is located 2816 bytes inside of freed 4096-byte region [ffff888034655500, ffff888034656500) The buggy address belongs to the physical page: page:ffffea0000d19400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x34650 head:ffffea0000d19400 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 ffff888140008780 ffffea000078f000 dead000000000002 raw: 0000000000000000 0000000000070007 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4491, tgid 4491 (udevd), ts 460154330020, free_ts 460043765961 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+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+0x8be/0x1570 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] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc+0x392/0x3b0 mm/slub.c:3502 getname_flags.part.0+0x50/0x4d0 fs/namei.c:140 getname_flags+0x9c/0xf0 include/linux/audit.h:321 user_path_at_empty+0x2c/0x60 fs/namei.c:2909 do_readlinkat+0xdd/0x2f0 fs/stat.c:533 __do_sys_readlink fs/stat.c:566 [inline] __se_sys_readlink fs/stat.c:563 [inline] __x64_sys_readlink+0x78/0xb0 fs/stat.c:563 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 __unfreeze_partials+0x21d/0x240 mm/slub.c:2655 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18b/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/slub.c:3478 [inline] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc+0x172/0x3b0 mm/slub.c:3502 getname_flags.part.0+0x50/0x4d0 fs/namei.c:140 getname_flags+0x9c/0xf0 include/linux/audit.h:321 user_path_at_empty+0x2c/0x60 fs/namei.c:2909 user_path_at include/linux/namei.h:57 [inline] __do_sys_chdir fs/open.c:551 [inline] __se_sys_chdir fs/open.c:545 [inline] __x64_sys_chdir+0xce/0x270 fs/open.c:545 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 Memory state around the buggy address: ffff888034655f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888034655f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888034656000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888034656080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888034656100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f] CPU: 0 PID: 22013 Comm: syz-executor.5 Tainted: G B 6.6.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023 RIP: 0010:ntfs_write_bh+0x5b/0x6e0 fs/ntfs3/fsntfs.c:1402 Code: 00 fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 6e 06 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 1b 48 8d 7b 18 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 42 06 00 00 8b 43 18 89 44 24 48 48 8b 44 24 10 RSP: 0018:ffffc9000360f218 EFLAGS: 00010216 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffc900098c1000 RDX: 0000000000000003 RSI: ffffffff81dd7197 RDI: 0000000000000018 RBP: 0000000000000000 R08: 0000000000000007 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: ffff88803bf1807c R13: ffff888034656000 R14: ffff88803bf18250 R15: ffff88803bf18290 FS: 00007f5415ff66c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f9e0d490000 CR3: 0000000029fdb000 CR4: 0000000000350ef0 Call Trace: 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_create_inode+0x317/0x4290 fs/ntfs3/inode.c:1307 ntfs_atomic_open+0x4d2/0x650 fs/ntfs3/namei.c:422 atomic_open fs/namei.c:3358 [inline] lookup_open.isra.0+0xc44/0x1360 fs/namei.c:3466 open_last_lookups fs/namei.c:3563 [inline] path_openat+0x931/0x29c0 fs/namei.c:3793 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_open fs/open.c:1445 [inline] __se_sys_open fs/open.c:1441 [inline] __x64_sys_open+0x154/0x1e0 fs/open.c:1441 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:0x7f541527cae9 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:00007f5415ff60c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007f541539bf80 RCX: 00007f541527cae9 RDX: 0000000000000000 RSI: 0000000000060142 RDI: 0000000020000000 RBP: 00007f54152c847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f541539bf80 R15: 00007ffdc347fc48 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:ntfs_write_bh+0x5b/0x6e0 fs/ntfs3/fsntfs.c:1402 Code: 00 fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 6e 06 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 1b 48 8d 7b 18 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 42 06 00 00 8b 43 18 89 44 24 48 48 8b 44 24 10 RSP: 0018:ffffc9000360f218 EFLAGS: 00010216 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffc900098c1000 RDX: 0000000000000003 RSI: ffffffff81dd7197 RDI: 0000000000000018 RBP: 0000000000000000 R08: 0000000000000007 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: ffff88803bf1807c R13: ffff888034656000 R14: ffff88803bf18250 R15: ffff88803bf18290 FS: 00007f5415ff66c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f9e0d490000 CR3: 0000000029fdb000 CR4: 0000000000350ef0 ---------------- Code disassembly (best guess), 4 bytes skipped: 0: 48 c1 ea 03 shr $0x3,%rdx 4: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) 8: 0f 85 6e 06 00 00 jne 0x67c e: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 15: fc ff df 18: 48 8b 1b mov (%rbx),%rbx 1b: 48 8d 7b 18 lea 0x18(%rbx),%rdi 1f: 48 89 fa mov %rdi,%rdx 22: 48 c1 ea 03 shr $0x3,%rdx * 26: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction 2a: 0f 85 42 06 00 00 jne 0x672 30: 8b 43 18 mov 0x18(%rbx),%eax 33: 89 44 24 48 mov %eax,0x48(%rsp) 37: 48 8b 44 24 10 mov 0x10(%rsp),%rax