syzbot


KASAN: slab-out-of-bounds Read in ntfs_iget5

Status: upstream: reported on 2024/12/03 01:28
Reported-by: syzbot+7f9842213310bb64a581@syzkaller.appspotmail.com
First crash: 18d, last: 6d20h
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in ntfs_iget5 7 400d 647d 0/3 auto-obsoleted due to no activity on 2024/02/25 08:58
linux-5.15 KASAN: use-after-free Read in ntfs_iget5 5 467d 608d 0/3 auto-obsoleted due to no activity on 2023/12/20 11:31
linux-5.15 KASAN: use-after-free Read in ntfs_iget5 (2) 5 164d 263d 0/3 auto-obsoleted due to no activity on 2024/10/18 06:28
upstream KASAN: slab-out-of-bounds Read in ntfs_iget5 ntfs3 C done done 3633 339d 974d 25/28 fixed on 2024/03/20 11:33
upstream BUG: unable to handle kernel paging request in ntfs_iget5 ntfs3 1 222d 218d 0/28 auto-obsoleted due to no activity on 2024/08/10 16:42
linux-6.1 KASAN: use-after-free Read in ntfs_iget5 (2) origin:upstream C error 10 5d05h 267d 0/3 upstream: reported C repro on 2024/03/29 09:18

Sample crash report:
ntfs3: loop2: Different NTFS' sector size (2048) and media sector size (512)
==================================================================
BUG: KASAN: slab-out-of-bounds in ntfs_iget5+0x153/0x38e0 fs/ntfs3/inode.c:526
Read of size 8 at addr ffff888074deff60 by task syz.2.1248/7136

CPU: 1 PID: 7136 Comm: syz.2.1248 Not tainted 5.15.173-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 ntfs_iget5+0x153/0x38e0 fs/ntfs3/inode.c:526
 ntfs_fill_super+0x237d/0x4340 fs/ntfs3/super.c:1004
 get_tree_bdev+0x3fe/0x620 fs/super.c:1325
 vfs_get_tree+0x88/0x270 fs/super.c:1530
 do_new_mount+0x2ba/0xb40 fs/namespace.c:3012
 do_mount fs/namespace.c:3355 [inline]
 __do_sys_mount fs/namespace.c:3563 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3540
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7fe32ad8e6ba
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe328c02e88 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fe328c02f10 RCX: 00007fe32ad8e6ba
RDX: 00000000200000c0 RSI: 000000002001f3c0 RDI: 00007fe328c02ed0
RBP: 00000000200000c0 R08: 00007fe328c02f10 R09: 0000000003004001
R10: 0000000003004001 R11: 0000000000000246 R12: 000000002001f3c0
R13: 00007fe328c02ed0 R14: 000000000001f3c9 R15: 0000000020000200
 </TASK>

Allocated by task 4472:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 __d_alloc+0x2a/0x700 fs/dcache.c:1749
 d_alloc+0x48/0x1d0 fs/dcache.c:1828
 lookup_one_qstr_excl+0xca/0x240 fs/namei.c:1559
 filename_create+0x293/0x530 fs/namei.c:3836
 do_symlinkat+0xf6/0x600 fs/namei.c:4448
 __do_sys_symlink fs/namei.c:4480 [inline]
 __se_sys_symlink fs/namei.c:4478 [inline]
 __x64_sys_symlink+0x7a/0x90 fs/namei.c:4478
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 4213:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
 rcu_do_batch kernel/rcu/tree.c:2523 [inline]
 rcu_core+0xa15/0x1650 kernel/rcu/tree.c:2763
 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
 __do_softirq kernel/softirq.c:592 [inline]
 invoke_softirq kernel/softirq.c:432 [inline]
 __irq_exit_rcu+0x157/0x240 kernel/softirq.c:641
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:653
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline]
 sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1108
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:676

Last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
 __dentry_kill+0x4f4/0x650 fs/dcache.c:600
 dentry_kill+0xbb/0x290
 dput+0xd8/0x1a0 fs/dcache.c:893
 do_unlinkat+0x4ae/0x950 fs/namei.c:4351
 __do_sys_unlink fs/namei.c:4396 [inline]
 __se_sys_unlink fs/namei.c:4394 [inline]
 __x64_sys_unlink+0x45/0x50 fs/namei.c:4394
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Second to last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
 __dentry_kill+0x4f4/0x650 fs/dcache.c:600
 dentry_kill+0xbb/0x290
 dput+0xd8/0x1a0 fs/dcache.c:893
 do_renameat2+0xe1c/0x1700 fs/namei.c:4987
 __do_sys_rename fs/namei.c:5031 [inline]
 __se_sys_rename fs/namei.c:5029 [inline]
 __x64_sys_rename+0x82/0x90 fs/namei.c:5029
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888074defd60
 which belongs to the cache dentry of size 312
The buggy address is located 200 bytes to the right of
 312-byte region [ffff888074defd60, ffff888074defe98)
The buggy address belongs to the page:
page:ffffea0001d37b80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x74dee
head:ffffea0001d37b80 order:1 compound_mapcount:0
memcg:ffff888024eb8001
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff8880175ea640
raw: 0000000000000000 0000000000150015 00000001ffffffff ffff888024eb8001
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 4292, ts 80522255158, free_ts 18779806240
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5464
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
 __d_alloc+0x2a/0x700 fs/dcache.c:1749
 d_alloc fs/dcache.c:1828 [inline]
 d_alloc_parallel+0xca/0x1390 fs/dcache.c:2582
 __lookup_slow+0x111/0x3d0 fs/namei.c:1648
 lookup_slow+0x53/0x70 fs/namei.c:1680
 walk_component+0x48c/0x610 fs/namei.c:1976
 lookup_last fs/namei.c:2431 [inline]
 path_lookupat+0x16f/0x450 fs/namei.c:2455
 filename_lookup+0x230/0x5c0 fs/namei.c:2484
 user_path_at_empty+0x40/0x180 fs/namei.c:2883
 user_path_at include/linux/namei.h:57 [inline]
 vfs_statx+0x106/0x3b0 fs/stat.c:221
 vfs_fstatat fs/stat.c:243 [inline]
 __do_sys_newfstatat fs/stat.c:411 [inline]
 __se_sys_newfstatat fs/stat.c:405 [inline]
 __x64_sys_newfstatat+0x12c/0x1b0 fs/stat.c:405
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 free_contig_range+0x95/0xf0 mm/page_alloc.c:9383
 destroy_args+0xfe/0x980 mm/debug_vm_pgtable.c:1018
 debug_vm_pgtable+0x40d/0x470 mm/debug_vm_pgtable.c:1331
 do_one_initcall+0x22b/0x7a0 init/main.c:1302
 do_initcall_level+0x157/0x210 init/main.c:1375
 do_initcalls+0x49/0x90 init/main.c:1391
 kernel_init_freeable+0x425/0x5c0 init/main.c:1615
 kernel_init+0x19/0x290 init/main.c:1506
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
 ffff888074defe00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888074defe80: fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888074deff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                       ^
 ffff888074deff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888074df0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/03 01:28 linux-5.15.y 0a51d2d4527b 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Read in ntfs_iget5
2024/12/14 19:51 linux-5.15.y 963e654022cc 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ntfs_iget5
* Struck through repros no longer work on HEAD.