syzbot


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

Status: upstream: reported C repro on 2023/01/04 05:55
Subsystems: ntfs
[Documentation on labels]
Reported-by: syzbot+a7a8de33e535be82e40f@syzkaller.appspotmail.com
First crash: 705d, last: 705d
Fix bisection: failed (error log, bisect log)
  
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 36d 592d 0/3 upstream: reported C repro on 2023/04/27 08:51
linux-4.14 KASAN: slab-out-of-bounds Read in ntfs_readdir ntfs C 1 645d 708d 0/1 upstream: reported C repro on 2022/12/31 19:18
upstream KASAN: slab-out-of-bounds Read in ntfs_readdir ntfs3 C error error 507 252d 712d 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 186d 550d 0/3 upstream: reported C repro on 2023/06/07 15:22

Sample crash report:
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+0x3ad2/0x4140 fs/ntfs/dir.c:1213
Read of size 1 at addr ffff8880a8e7eb71 by task syz-executor136/8089

CPU: 1 PID: 8089 Comm: syz-executor136 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load1_noabort+0x88/0x90 mm/kasan/report.c:430
 ntfs_filldir fs/ntfs/dir.c:1034 [inline]
 ntfs_readdir+0x3ad2/0x4140 fs/ntfs/dir.c:1213
 iterate_dir+0x1fe/0x5c0 fs/readdir.c:53
 ksys_getdents64+0x175/0x2b0 fs/readdir.c:357
 __do_sys_getdents64 fs/readdir.c:376 [inline]
 __se_sys_getdents64 fs/readdir.c:373 [inline]
 __x64_sys_getdents64+0x6f/0xb0 fs/readdir.c:373
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f5a3bc00789
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 14 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffdef08f8f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5a3bc00789
RDX: 0000000000000098 RSI: 0000000020000080 RDI: 0000000000000004
RBP: 00007f5a3bbc0020 R08: 0000000000000000 R09: 0000000000000000
R10: 000000000001e706 R11: 0000000000000246 R12: 00007f5a3bbc00b0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 8089:
 __do_kmalloc mm/slab.c:3727 [inline]
 __kmalloc+0x15a/0x3c0 mm/slab.c:3736
 kmalloc include/linux/slab.h:520 [inline]
 ntfs_readdir+0x3d3/0x4140 fs/ntfs/dir.c:1175
 iterate_dir+0x1fe/0x5c0 fs/readdir.c:53
 ksys_getdents64+0x175/0x2b0 fs/readdir.c:357
 __do_sys_getdents64 fs/readdir.c:376 [inline]
 __se_sys_getdents64 fs/readdir.c:373 [inline]
 __x64_sys_getdents64+0x6f/0xb0 fs/readdir.c:373
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4699:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 __d_free_external+0x3f/0x60 fs/dcache.c:276
 __rcu_reclaim kernel/rcu/rcu.h:236 [inline]
 rcu_do_batch kernel/rcu/tree.c:2584 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2897 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2864 [inline]
 rcu_process_callbacks+0x8ff/0x18b0 kernel/rcu/tree.c:2881
 __do_softirq+0x265/0x980 kernel/softirq.c:292

The buggy address belongs to the object at ffff8880a8e7eb00
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 49 bytes to the right of
 64-byte region [ffff8880a8e7eb00, ffff8880a8e7eb40)
The buggy address belongs to the page:
page:ffffea0002a39f80 count:1 mapcount:0 mapping:ffff88813bff0340 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002a7f788 ffffea0002a68748 ffff88813bff0340
raw: 0000000000000000 ffff8880a8e7e000 0000000100000020 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a8e7ea00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff8880a8e7ea80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8880a8e7eb00: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
                                                             ^
 ffff8880a8e7eb80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff8880a8e7ec00: 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
2023/01/04 05:54 linux-4.19.y 3f8a27f9e27b f0036e18 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: slab-out-of-bounds Read in ntfs_readdir
* Struck through repros no longer work on HEAD.