syzbot


KASAN: use-after-free Read in hdr_find_e

Status: upstream: reported C repro on 2022/09/27 11:46
Reported-by: syzbot+c986d2a447ac6fb27b02@syzkaller.appspotmail.com
First crash: 60d, last: 5d18h

Cause bisection: introduced by (bisect log) :
commit 6e5be40d32fb1907285277c02e74493ed43d77fe
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Date: Fri Aug 13 14:21:30 2021 +0000

  fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile

Crash: KASAN: slab-out-of-bounds Read in hdr_find_e (log)
Repro: C syz .config

Sample crash report:
loop0: detected capacity change from 0 to 264192
ntfs3: loop0: Different NTFS' sector size (2048) and media sector size (512)
ntfs3: loop0: Mark volume as dirty due to NTFS errors
ntfs3: loop0: Failed to load $Extend.
==================================================================
BUG: KASAN: use-after-free in hdr_find_e.isra.0+0x527/0x590 fs/ntfs3/index.c:689
Read of size 2 at addr ffff888098c3651f by task syz-executor129/3611

CPU: 1 PID: 3611 Comm: syz-executor129 Not tainted 6.0.0-syzkaller-09589-g55be6084c8e0 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:317 [inline]
 print_report.cold+0x2ba/0x719 mm/kasan/report.c:433
 kasan_report+0xb1/0x1e0 mm/kasan/report.c:495
 hdr_find_e.isra.0+0x527/0x590 fs/ntfs3/index.c:689
 indx_find+0x25a/0x980 fs/ntfs3/index.c:1068
 dir_search_u+0x232/0x3f0 fs/ntfs3/dir.c:254
 ntfs_lookup+0x174/0x1e0 fs/ntfs3/namei.c:83
 __lookup_slow+0x24c/0x460 fs/namei.c:1685
 lookup_slow fs/namei.c:1702 [inline]
 walk_component+0x33f/0x5a0 fs/namei.c:1993
 lookup_last fs/namei.c:2450 [inline]
 path_lookupat+0x1ba/0x840 fs/namei.c:2474
 filename_lookup+0x1ce/0x590 fs/namei.c:2503
 vfs_statx+0x14c/0x430 fs/stat.c:229
 vfs_fstatat+0x8c/0xb0 fs/stat.c:267
 __do_sys_newfstatat+0x94/0x120 fs/stat.c:437
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f07f3295599
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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:00007ffe3d7c28d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000106
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f07f3295599
RDX: 0000000000000000 RSI: 0000000020000380 RDI: ffffffffffffff9c
RBP: 00007f07f3254ad0 R08: 00007ffe3d7c27c0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f07f3254b60
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0002630d80 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x98c36
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0002630d88 ffffea0002630d88 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner info is not present (never set?)

Memory state around the buggy address:
 ffff888098c36400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888098c36480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888098c36500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                            ^
 ffff888098c36580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888098c36600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (48):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-root 2022/10/11 11:06 upstream 55be6084c8e0 2b253ced .config log report syz C KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/10/05 23:57 upstream 2bca25eaeba6 2c6543ad .config log report syz C KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/09/27 07:44 upstream 3800a713b607 10323ddf .config log report syz C KASAN: use-after-free Read in hdr_find_e
ci-upstream-linux-next-kasan-gce-root 2022/11/07 00:27 linux-next 0cdb3579f1ee 6d752409 .config log report syz C KASAN: use-after-free Read in hdr_find_e
ci-upstream-kasan-gce-root 2022/10/10 02:28 upstream a6afa4199d3d aea5da89 .config log report syz C KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/11/21 07:17 upstream eb7081409f94 5bb70014 .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/11/20 06:12 upstream fe24a97cf254 5bb70014 .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/11/16 10:49 upstream 81e7cfa3a9eb 3a127a31 .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/11/12 16:02 upstream 8f2975c2bb4c f42ee5d8 .config log report info KASAN: use-after-free Read in hdr_find_e
ci-upstream-kasan-gce-root 2022/11/12 11:23 upstream f9bbe0c99e5b 3ead01ad .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/11/08 20:45 upstream 59f2f4b8a757 060f945e .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/11/03 10:42 upstream b229b6ca5abb 7a2ebf95 .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/11/02 09:57 upstream b229b6ca5abb 08977f5d .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/10/31 04:05 upstream b229b6ca5abb 2a71366b .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/10/24 23:22 upstream 247f34f7b803 faae2fda .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/10/24 04:12 upstream d47136c28015 23bf86af .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/10/17 18:13 upstream 493ffd6605b2 94744d21 .config log report info KASAN: use-after-free Read in hdr_find_e
ci-upstream-kasan-gce-root 2022/10/17 10:23 upstream 55be6084c8e0 67cb024c .config log report info KASAN: use-after-free Read in hdr_find_e
ci-upstream-kasan-gce-smack-root 2022/10/14 20:10 upstream 55be6084c8e0 4954e4b2 .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/10/13 05:13 upstream 493ffd6605b2 3f6b40a1 .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/10/09 21:27 upstream a6afa4199d3d aea5da89 .config log report info KASAN: use-after-free Read in hdr_find_e
ci-upstream-kasan-gce-smack-root 2022/10/08 17:05 upstream e8bc52cb8df8 aea5da89 .config log report info KASAN: use-after-free Read in hdr_find_e
ci-qemu-upstream-386 2022/10/30 01:09 upstream 200204f56f3b 2a71366b .config log report info KASAN: use-after-free Read in hdr_find_e
ci2-upstream-fs 2022/11/19 07:13 upstream ab290eaddc4c 5bb70014 .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/11/17 10:37 upstream cc675d22e422 3a127a31 .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/11/17 05:06 upstream 59d0d52c30d4 3a127a31 .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/11/08 13:09 upstream 59f2f4b8a757 060f945e .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/11/05 20:15 upstream b208b9fbbcba 6d752409 .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci-upstream-kasan-gce-root 2022/11/01 08:06 upstream b229b6ca5abb a1d8560a .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci-qemu-upstream 2022/11/01 06:42 upstream 200204f56f3b 43f72c2d .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci-upstream-kasan-gce-root 2022/10/30 03:14 upstream b229b6ca5abb 2a71366b .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/30 01:21 upstream b229b6ca5abb 2a71366b .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/30 00:58 upstream b229b6ca5abb 2a71366b .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/28 12:19 upstream b229b6ca5abb 8168b69e .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/28 01:17 upstream b229b6ca5abb 5c716ff6 .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/27 21:58 upstream b229b6ca5abb 5c716ff6 .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/21 18:41 upstream 6d36c728bc2e 63e790dd .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/21 03:17 upstream 493ffd6605b2 a0fd4dab .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/21 00:17 upstream 493ffd6605b2 a0fd4dab .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/19 03:42 upstream 493ffd6605b2 b31320fc .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/14 17:53 upstream 493ffd6605b2 4954e4b2 .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/12 03:11 upstream 493ffd6605b2 02b6492e .config log report info BUG: unable to handle kernel paging request in hdr_find_e
ci2-upstream-fs 2022/10/11 12:28 upstream 493ffd6605b2 5bcf0c31 .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/10 17:50 upstream 493ffd6605b2 5bcf0c31 .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci-upstream-kasan-gce-smack-root 2022/10/10 16:14 upstream 4899a36f91a9 aea5da89 .config log report info BUG: unable to handle kernel NULL pointer dereference in hdr_find_e
ci-upstream-kasan-gce-root 2022/10/08 16:47 upstream e8bc52cb8df8 aea5da89 .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
ci2-upstream-fs 2022/10/06 18:10 upstream 833477fce7a1 80b58a42 .config log report info BUG: unable to handle kernel NULL pointer dereference in hdr_find_e
ci-qemu-upstream-386 2022/11/01 06:29 upstream 200204f56f3b 43f72c2d .config log report info KASAN: slab-out-of-bounds Read in hdr_find_e
* Struck through repros no longer work on HEAD.