syzbot


KASAN: use-after-free Read in ntfs_attr_find

Status: fixed on 2023/02/24 13:50
Subsystems: ntfs3
[Documentation on labels]
Reported-by: syzbot+5f8dcabe4a3b2c51c607@syzkaller.appspotmail.com
Fix commit: 36a4d82dddbb ntfs: fix out-of-bounds read in ntfs_attr_find()
First crash: 610d, last: 443d
Cause bisection: introduced by (bisect log) :
commit 38c9c22a85aeed28d0831f230136e9cf6fa2ed44
Author: ChenXiaoSong <chenxiaosong2@huawei.com>
Date: Thu Jul 7 10:53:29 2022 +0000

  ntfs: fix use-after-free in ntfs_ucsncmp()

Crash: KASAN: use-after-free Read in ntfs_attr_find (log)
Repro: C syz .config
  
Discussions (4)
Title Replies (including bot) Last reply
[PATCH v2 0/3] ntfs: fix bugs about Attribute 4 (4) 2022/08/31 16:09
[PATCH 0/3] ntfs: fix bugs about Attribute 10 (10) 2022/08/31 12:47
[PATCH] ntfs: change check order in ntfs_attr_find 15 (16) 2022/08/29 09:51
[syzbot] KASAN: use-after-free Read in ntfs_attr_find 2 (3) 2022/08/25 18:34
Similar bugs (12)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in ntfs_attr_find origin:upstream missing-backport C error 3 6d19h 96d 0/3 upstream: reported C repro on 2024/01/20 12:39
linux-6.1 KASAN: use-after-free Read in ntfs_attr_find 3 369d 380d 0/3 auto-obsoleted due to no activity on 2023/08/21 05:46
linux-4.14 KASAN: slab-out-of-bounds Read in ntfs_attr_find (2) C 31 424d 610d 0/1 upstream: reported C repro on 2022/08/25 11:21
upstream KASAN: use-after-free Read in ntfs_attr_find (2) ntfs3 C error done 22 68d 421d 0/26 upstream: reported C repro on 2023/03/01 23:29
linux-4.19 KASAN: use-after-free Read in ntfs_attr_find (2) C 1 425d 425d 0/1 upstream: reported C repro on 2023/02/26 02:15
linux-4.14 KASAN: use-after-free Read in ntfs_attr_find C done 4 1291d 1311d 1/1 fixed on 2020/11/12 10:36
linux-4.19 KASAN: use-after-free Read in ntfs_attr_find C done 13 1276d 1307d 1/1 fixed on 2020/11/27 11:32
linux-6.1 KASAN: use-after-free Read in ntfs_attr_find (2) origin:upstream missing-backport C inconclusive 1 35d 126d 0/3 upstream: reported C repro on 2023/12/22 04:54
linux-5.15 KASAN: slab-out-of-bounds Read in ntfs_attr_find 1 368d 368d 0/3 auto-obsoleted due to no activity on 2023/08/22 04:27
upstream KASAN: slab-out-of-bounds Read in ntfs_attr_find ntfs3 C done 9 1290d 2215d 15/26 fixed on 2020/11/16 12:12
linux-4.14 KASAN: slab-out-of-bounds Read in ntfs_attr_find C done 10 1283d 1311d 1/1 fixed on 2020/11/20 16:27
linux-4.19 KASAN: slab-out-of-bounds Read in ntfs_attr_find C done 10 1250d 1307d 1/1 fixed on 2020/12/23 11:20
Last patch testing requests (4)
Created Duration User Patch Repo Result
2022/08/30 16:32 16m yin31149@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master OK log
2022/08/29 14:37 15m yin31149@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master OK log
2022/08/29 09:44 17m yin31149@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master OK log
2022/08/26 12:33 16m yin31149@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master OK log

Sample crash report:
ntfs: (device loop0): check_mft_mirror(): Incomplete multi sector transfer detected in mft mirror record 0.
ntfs: (device loop0): load_system_files(): $MFTMirr does not match $MFT.  Mounting read-only.  Run ntfsfix and/or chkdsk.
==================================================================
BUG: KASAN: use-after-free in ntfs_attr_find+0xb88/0xce0 fs/ntfs/attrib.c:597
Read of size 2 at addr ffff88806ff431d2 by task syz-executor323/3611

CPU: 0 PID: 3611 Comm: syz-executor323 Not tainted 6.0.0-syzkaller-09039-ga6afa4199d3d #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
 ntfs_attr_find+0xb88/0xce0 fs/ntfs/attrib.c:597
 ntfs_attr_lookup+0x1056/0x2070 fs/ntfs/attrib.c:1193
 ntfs_read_locked_inode+0xb0c/0x5ae0 fs/ntfs/inode.c:999
 ntfs_iget+0x12d/0x180 fs/ntfs/inode.c:177
 load_system_files fs/ntfs/super.c:1847 [inline]
 ntfs_fill_super+0x3d0d/0x92d0 fs/ntfs/super.c:2892
 mount_bdev+0x34d/0x410 fs/super.c:1400
 legacy_get_tree+0x105/0x220 fs/fs_context.c:610
 vfs_get_tree+0x89/0x2f0 fs/super.c:1530
 do_new_mount fs/namespace.c:3040 [inline]
 path_mount+0x1326/0x1e20 fs/namespace.c:3370
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount fs/namespace.c:3568 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568
 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:0x7f4c77147b4a
Code: 48 c7 c2 c0 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 a8 00 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 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:00007ffc4fae6598 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f4c77147b4a
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffc4fae65b0
RBP: 00007ffc4fae65b0 R08: 00007ffc4fae65f0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000286 R12: 0000000000000004
R13: 00007ffc4fae65f0 R14: 000000000000013c R15: 0000000020001fa0
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001bfd0c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x6ff43
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001bfd108 ffff8880b9a407a0 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Movable, gfp_mask 0x140dca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_ZERO), pid 3404, tgid 3404 (sshd), ts 27637676427, free_ts 27648698222
 prep_new_page mm/page_alloc.c:2532 [inline]
 get_page_from_freelist+0x109b/0x2ce0 mm/page_alloc.c:4283
 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5549
 __folio_alloc+0x12/0x40 mm/page_alloc.c:5580
 vma_alloc_folio+0xf9/0x780 mm/mempolicy.c:2231
 alloc_page_vma include/linux/gfp.h:290 [inline]
 do_anonymous_page mm/memory.c:4084 [inline]
 handle_pte_fault mm/memory.c:4915 [inline]
 __handle_mm_fault+0x1784/0x39b0 mm/memory.c:5059
 handle_mm_fault+0x1c8/0x780 mm/memory.c:5157
 do_user_addr_fault+0x475/0x1210 arch/x86/mm/fault.c:1407
 handle_page_fault arch/x86/mm/fault.c:1498 [inline]
 exc_page_fault+0x94/0x170 arch/x86/mm/fault.c:1554
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1449 [inline]
 free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1499
 free_unref_page_prepare mm/page_alloc.c:3380 [inline]
 free_unref_page_list+0x16f/0xb90 mm/page_alloc.c:3522
 release_pages+0xbd3/0x1400 mm/swap.c:1012
 tlb_batch_pages_flush+0xa8/0x1a0 mm/mmu_gather.c:58
 tlb_flush_mmu_free mm/mmu_gather.c:255 [inline]
 tlb_flush_mmu mm/mmu_gather.c:262 [inline]
 tlb_finish_mmu+0x147/0x7e0 mm/mmu_gather.c:353
 unmap_region+0x27f/0x350 mm/mmap.c:2625
 __do_munmap+0x6bd/0x10b0 mm/mmap.c:2836
 __vm_munmap+0xf7/0x230 mm/mmap.c:2859
 __do_sys_munmap mm/mmap.c:2884 [inline]
 __se_sys_munmap mm/mmap.c:2881 [inline]
 __x64_sys_munmap+0x55/0x80 mm/mmap.c:2881
 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

Memory state around the buggy address:
 ffff88806ff43080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88806ff43100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88806ff43180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                                 ^
 ffff88806ff43200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88806ff43280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (74):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/10/10 00:26 upstream a6afa4199d3d aea5da89 .config strace log report syz C [disk image] [vmlinux] [mounted in repro] ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/10/09 22:39 upstream a6afa4199d3d aea5da89 .config strace log report syz C [disk image] [vmlinux] [mounted in repro] ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/10/04 15:16 upstream 4fe89d07dcc2 eab8f949 .config strace log report syz C [disk image] [vmlinux] [mounted in repro] ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/10/04 02:11 upstream 4fe89d07dcc2 feb56351 .config strace log report syz C [disk image] [vmlinux] ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/09/26 06:12 upstream f76349cf4145 0042f2b4 .config strace log report syz C ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/09/26 00:51 upstream 105a36f3694e 0042f2b4 .config strace log report syz C [disk image] [vmlinux] ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/09/25 20:45 upstream 105a36f3694e 0042f2b4 .config strace log report syz C [disk image] [vmlinux] ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/09/25 12:30 upstream 3db61221f4e8 0042f2b4 .config console log report syz C ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/09/25 05:57 upstream 1a61b828566f 0042f2b4 .config strace log report syz C [disk image] [vmlinux] ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/09/25 04:53 upstream 3db61221f4e8 0042f2b4 .config strace log report syz C ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/08/25 01:32 upstream c40e8341e3b3 514514f6 .config strace log report syz C ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/08/25 01:30 linux-next 68a00424bf69 514514f6 .config strace log report syz C ci-upstream-linux-next-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/10/07 15:00 upstream 4c86114194e6 79a59635 .config strace log report syz C [mounted in repro] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_attr_find
2022/09/19 23:05 upstream 521a547ced64 dd9a85ff .config strace log report syz C [disk image] [vmlinux] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_attr_find
2023/02/08 01:59 upstream 05ecb680708a 15c3d445 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in ntfs_attr_find
2023/01/08 05:06 upstream 0a71553536d2 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/10/19 01:34 upstream 55be6084c8e0 b31320fc .config console log report info [disk image] [vmlinux] ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/10/16 15:24 upstream 493ffd6605b2 67cb024c .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/10/13 21:18 upstream 55be6084c8e0 adf90437 .config console log report info [disk image] [vmlinux] ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in ntfs_attr_find
2022/10/12 21:39 upstream 55be6084c8e0 89b5a509 .config console log report info ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in ntfs_attr_find
2022/10/10 03:58 upstream a6afa4199d3d aea5da89 .config console log report info [disk image] [vmlinux] ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/10/08 20:47 upstream e8bc52cb8df8 aea5da89 .config console log report info [disk image] [vmlinux] ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/10/06 08:34 upstream 833477fce7a1 2c6543ad .config console log report info ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in ntfs_attr_find
2022/10/03 08:21 upstream a962b54e162c feb56351 .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/10/01 02:24 upstream 5a77386984b5 feb56351 .config console log report info ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in ntfs_attr_find
2022/09/30 13:59 upstream 987a926c1d8a 1d385642 .config console log report info ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/09/29 14:32 upstream c3e0e1e23c70 1d385642 .config console log report info ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in ntfs_attr_find
2022/09/29 13:44 upstream c3e0e1e23c70 1d385642 .config console log report info [disk image] [vmlinux] ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in ntfs_attr_find
2022/09/29 13:43 upstream c3e0e1e23c70 1d385642 .config console log report info [disk image] [vmlinux] ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/09/29 11:06 upstream 49c13ed0316d a41a2080 .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/09/27 05:27 upstream 3800a713b607 10323ddf .config console log report info ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/09/22 04:11 upstream 06f7db949993 60af5050 .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/09/21 05:00 upstream 60891ec99e14 c4b8ccfd .config console log report info ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in ntfs_attr_find
2022/09/21 04:59 upstream 60891ec99e14 c4b8ccfd .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/09/21 04:57 upstream 60891ec99e14 c4b8ccfd .config console log report info [disk image] [vmlinux] ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in ntfs_attr_find
2022/09/21 04:55 upstream 60891ec99e14 c4b8ccfd .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/09/21 04:09 upstream 60891ec99e14 c4b8ccfd .config console log report info ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/09/20 03:12 upstream 521a547ced64 dd9a85ff .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: use-after-free Read in ntfs_attr_find
2022/09/19 21:53 upstream 521a547ced64 dd9a85ff .config console log report info ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/09/10 17:29 upstream ce888220d5c7 356d8217 .config console log report info ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in ntfs_attr_find
2022/08/29 04:59 upstream 8379c0b31fbc 07177916 .config console log report info ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in ntfs_attr_find
2022/08/29 03:49 upstream 8379c0b31fbc 07177916 .config console log report info ci-qemu-upstream KASAN: use-after-free Read in ntfs_attr_find
2022/08/25 01:15 upstream c40e8341e3b3 514514f6 .config console log report info ci-upstream-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/10/10 03:48 upstream 4899a36f91a9 aea5da89 .config console log report info ci-qemu-upstream-386 KASAN: use-after-free Read in ntfs_attr_find
2022/08/29 01:16 upstream 8379c0b31fbc 07177916 .config console log report info ci-qemu-upstream-386 KASAN: use-after-free Read in ntfs_attr_find
2022/08/31 19:48 linux-next 7fd22855300e 51e54e30 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/08/25 01:15 linux-next 68a00424bf69 514514f6 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: use-after-free Read in ntfs_attr_find
2022/10/14 02:35 upstream 493ffd6605b2 4954e4b2 .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_attr_find
2022/10/13 12:50 upstream 493ffd6605b2 adf90437 .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_attr_find
2022/10/12 11:15 upstream 493ffd6605b2 02b6492e .config console log report info [disk image] [vmlinux] ci2-upstream-fs BUG: unable to handle kernel paging request in ntfs_attr_find
2022/09/26 11:35 upstream f76349cf4145 d59ba983 .config console log report info ci-upstream-kasan-gce-selinux-root BUG: unable to handle kernel paging request in ntfs_attr_find
2022/09/23 19:21 upstream bf682942cd26 0042f2b4 .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_attr_find
2022/09/21 13:00 upstream 60891ec99e14 380f82fb .config console log report info [disk image] [vmlinux] ci2-upstream-fs BUG: unable to handle kernel paging request in ntfs_attr_find
2022/09/21 07:20 upstream 60891ec99e14 c4b8ccfd .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_attr_find
2022/09/21 05:00 upstream 60891ec99e14 c4b8ccfd .config console log report info ci-qemu-upstream KASAN: slab-out-of-bounds Read in ntfs_attr_find
2022/09/19 21:27 upstream 521a547ced64 dd9a85ff .config console log report info ci-upstream-kasan-gce-smack-root KASAN: slab-out-of-bounds Read in ntfs_attr_find
2022/09/19 21:26 upstream 521a547ced64 dd9a85ff .config console log report info ci-qemu-upstream KASAN: slab-out-of-bounds Read in ntfs_attr_find
2022/08/29 05:08 upstream 8379c0b31fbc 07177916 .config console log report info ci-upstream-kasan-gce-selinux-root KASAN: slab-out-of-bounds Read in ntfs_attr_find
2022/08/29 03:04 upstream 8379c0b31fbc 07177916 .config console log report info ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Read in ntfs_attr_find
2022/09/19 21:30 upstream 521a547ced64 dd9a85ff .config console log report info ci-qemu-upstream-386 KASAN: slab-out-of-bounds Read in ntfs_attr_find
* Struck through repros no longer work on HEAD.