syzbot


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

Status: upstream: reported C repro on 2022/12/31 19:18
Subsystems: ntfs
[Documentation on labels]
Reported-by: syzbot+6b0c1e6cf3c7a9345fb1@syzkaller.appspotmail.com
First crash: 705d, last: 642d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: slab-out-of-bounds Read in ntfs_readdir missing-backport origin:lts-only C done 37 32d 588d 0/3 upstream: reported C repro on 2023/04/27 08:51
linux-4.19 KASAN: slab-out-of-bounds Read in ntfs_readdir ntfs C error 1 702d 702d 0/1 upstream: reported C repro on 2023/01/04 05:55
upstream KASAN: slab-out-of-bounds Read in ntfs_readdir ntfs3 C error error 507 249d 708d 0/28 auto-obsoleted due to no activity on 2024/06/09 18:46
linux-6.1 KASAN: slab-out-of-bounds Read in ntfs_readdir origin:upstream missing-backport C done 63 183d 547d 0/3 upstream: reported C repro on 2023/06/07 15:22
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2023/03/04 20:04 24m bisect fix linux-4.14.y OK (0) job log log
2023/02/02 18:27 31m bisect fix linux-4.14.y OK (0) job log log

Sample crash report:
ntfs: (device loop0): check_windows_hibernation_status(): Failed to find inode number for hiberfil.sys.
ntfs: (device loop0): load_system_files(): Failed to determine if Windows is hibernated.  Will not be able to remount read-write.  Run chkdsk.
ntfs: (device loop0): map_mft_record_page(): Attempt to read mft record 0x10000, which is beyond the end of the mft.  This is probably a bug in the ntfs driver.
ntfs: (device loop0): map_mft_record(): Failed with error code 2.
==================================================================
BUG: KASAN: slab-out-of-bounds in ntfs_filldir fs/ntfs/dir.c:1034 [inline]
BUG: KASAN: slab-out-of-bounds in ntfs_readdir+0x2fd3/0x37f0 fs/ntfs/dir.c:1213
Read of size 1 at addr ffff8880b3f10971 by task syz-executor223/7964

CPU: 0 PID: 7964 Comm: syz-executor223 Not tainted 4.14.302-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load1_noabort+0x68/0x70 mm/kasan/report.c:427
 ntfs_filldir fs/ntfs/dir.c:1034 [inline]
 ntfs_readdir+0x2fd3/0x37f0 fs/ntfs/dir.c:1213
 iterate_dir+0x478/0x5e0 fs/readdir.c:54
 SYSC_getdents64 fs/readdir.c:358 [inline]
 SyS_getdents64+0x125/0x230 fs/readdir.c:339
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3
RIP: 0033:0x7fd4c153a789
RSP: 002b:00007ffca8591da8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fd4c153a789
RDX: 0000000000000098 RSI: 0000000020000080 RDI: 0000000000000004
RBP: 00007fd4c14fa020 R08: 0000000000000000 R09: 0000000000000000
R10: 000000000001e706 R11: 0000000000000246 R12: 00007fd4c14fa0b0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7964:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 __do_kmalloc mm/slab.c:3720 [inline]
 __kmalloc+0x15a/0x400 mm/slab.c:3729
 kmalloc include/linux/slab.h:493 [inline]
 ntfs_readdir+0x37d/0x37f0 fs/ntfs/dir.c:1175
 iterate_dir+0x478/0x5e0 fs/readdir.c:54
 SYSC_getdents64 fs/readdir.c:358 [inline]
 SyS_getdents64+0x125/0x230 fs/readdir.c:339
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Freed by task 17:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xc9/0x250 mm/slab.c:3815
 __d_free_external+0x3f/0x60 fs/dcache.c:289
 __rcu_reclaim kernel/rcu/rcu.h:195 [inline]
 rcu_do_batch kernel/rcu/tree.c:2699 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2929 [inline]
 rcu_process_callbacks+0x780/0x1180 kernel/rcu/tree.c:2946
 __do_softirq+0x24d/0x9ff kernel/softirq.c:288

The buggy address belongs to the object at ffff8880b3f10900
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 49 bytes to the right of
 64-byte region [ffff8880b3f10900, ffff8880b3f10940)
The buggy address belongs to the page:
page:ffffea0002cfc400 count:1 mapcount:0 mapping:ffff8880b3f10000 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880b3f10000 0000000000000000 0000000100000020
raw: ffffea0002a77620 ffffea0002598ea0 ffff88813fe74340 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880b3f10800: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff8880b3f10880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8880b3f10900: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
                                                             ^
 ffff8880b3f10980: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff8880b3f10a00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/12/31 19:17 linux-4.14.y c4215ee4771b ab32d508 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-4-14 KASAN: slab-out-of-bounds Read in ntfs_readdir
* Struck through repros no longer work on HEAD.