syzbot


KASAN: use-after-free Read in bcmp

Status: fixed on 2023/12/21 03:45
Subsystems: ntfs3
[Documentation on labels]
Reported-by: syzbot+53ce40c8c0322c06aea5@syzkaller.appspotmail.com
Fix commit: 34e6552a442f fs/ntfs3: Fix OOB read in ntfs_init_from_boot
First crash: 240d, last: 77d
Cause bisection: introduced by (bisect log) :
commit 6a4cd3ea7d771be17177d95ff67d22cfa2a38b50
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Date: Mon May 8 07:56:13 2023 +0000

  fs/ntfs3: Alternative boot if primary boot is corrupted

Crash: KASAN: use-after-free Read in bcmp (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] [ntfs3?] KASAN: use-after-free Read in bcmp 1 (3) 2023/07/13 21:47
[PATCH] ntfs3: fix OOB read in ntfs_init_from_boot 1 (1) 2023/07/13 19:41
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KMSAN: uninit-value in bcmp net C error done 907 410d 1731d 22/26 fixed on 2023/02/24 13:50
upstream KMSAN: uninit-value in bcmp (2) btrfs C 7 28d 50d 1/26 upstream: reported C repro on 2024/01/14 10:15
Last patch testing requests (2)
Created Duration User Patch Repo Result
2023/10/05 09:41 15m almaz.alexandrovich@paragon-software.com https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master report log
2023/07/13 18:24 48m paskripkin@gmail.com patch upstream OK log

Sample crash report:
ntfs3: loop0: RAW NTFS volume: Filesystem size 16384.00 Gb > volume size 0.00 Gb. Mount in read-only.
ntfs3: loop0: NTFS 16384.00 Gb is too big to use 32 bits per cluster.
==================================================================
BUG: KASAN: use-after-free in memcmp lib/string.c:681 [inline]
BUG: KASAN: use-after-free in bcmp+0xc0/0x1e0 lib/string.c:713
Read of size 8 at addr ffff88807f7cb002 by task syz-executor327/5031

CPU: 1 PID: 5031 Comm: syz-executor327 Not tainted 6.6.0-rc3-syzkaller-00055-g9ed22ae6be81 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0x163/0x540 mm/kasan/report.c:475
 kasan_report+0x175/0x1b0 mm/kasan/report.c:588
 memcmp lib/string.c:681 [inline]
 bcmp+0xc0/0x1e0 lib/string.c:713
 ntfs_init_from_boot fs/ntfs3/super.c:858 [inline]
 ntfs_fill_super+0x9c2/0x4c50 fs/ntfs3/super.c:1139
 get_tree_bdev+0x416/0x5b0 fs/super.c:1577
 vfs_get_tree+0x8c/0x280 fs/super.c:1750
 do_new_mount+0x28f/0xae0 fs/namespace.c:3335
 do_mount fs/namespace.c:3675 [inline]
 __do_sys_mount fs/namespace.c:3884 [inline]
 __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3861
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f04d4841c1a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe6d0d7298 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffe6d0d72b0 RCX: 00007f04d4841c1a
RDX: 000000002001f180 RSI: 000000002001f1c0 RDI: 00007ffe6d0d72b0
RBP: 0000000000000004 R08: 00007ffe6d0d72f0 R09: 000000000001f17a
R10: 000000000000000e R11: 0000000000000286 R12: 000000000000000e
R13: 00007ffe6d0d72f0 R14: 0000000000000003 R15: 0000000000200000
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001fdf2c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x7f7cb
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000000 ffffea0001fdf308 ffff8880b9942220 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 5031, tgid 5031 (syz-executor327), ts 73347469618, free_ts 73380766869
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1536
 prep_new_page mm/page_alloc.c:1543 [inline]
 get_page_from_freelist+0x31db/0x3360 mm/page_alloc.c:3170
 __alloc_pages+0x255/0x670 mm/page_alloc.c:4426
 __folio_alloc+0x13/0x30 mm/page_alloc.c:4458
 vma_alloc_folio+0x48a/0x9a0 mm/mempolicy.c:2259
 do_anonymous_page mm/memory.c:4110 [inline]
 do_pte_missing mm/memory.c:3667 [inline]
 handle_pte_fault mm/memory.c:4978 [inline]
 __handle_mm_fault mm/memory.c:5119 [inline]
 handle_mm_fault+0x2376/0x62b0 mm/memory.c:5284
 do_user_addr_fault arch/x86/mm/fault.c:1364 [inline]
 handle_page_fault arch/x86/mm/fault.c:1505 [inline]
 exc_page_fault+0x455/0x860 arch/x86/mm/fault.c:1561
 asm_exc_page_fault+0x26/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:1136 [inline]
 free_unref_page_prepare+0x8c3/0x9f0 mm/page_alloc.c:2312
 free_unref_page_list+0x596/0x830 mm/page_alloc.c:2451
 release_pages+0x2113/0x23f0 mm/swap.c:1042
 tlb_batch_pages_flush mm/mmu_gather.c:98 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:293 [inline]
 tlb_flush_mmu+0x34c/0x4e0 mm/mmu_gather.c:300
 tlb_finish_mmu+0xd4/0x1f0 mm/mmu_gather.c:392
 unmap_region+0x300/0x350 mm/mmap.c:2318
 do_vmi_align_munmap+0x121e/0x1850 mm/mmap.c:2555
 do_vmi_munmap+0x24d/0x2d0 mm/mmap.c:2623
 __vm_munmap+0x230/0x450 mm/mmap.c:2908
 __do_sys_munmap mm/mmap.c:2925 [inline]
 __se_sys_munmap mm/mmap.c:2922 [inline]
 __x64_sys_munmap+0x69/0x80 mm/mmap.c:2922
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff88807f7caf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88807f7caf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88807f7cb000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88807f7cb080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88807f7cb100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (289):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/09/29 16:24 upstream 9ed22ae6be81 d265efd8 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in bcmp
2023/07/11 03:50 upstream 3f01e9fed845 d47e94ee .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/07/08 08:00 upstream 8689f4f2ea56 668cb1fa .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/19 16:49 upstream dd72f9c7e512 42e1d524 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/19 07:12 upstream dd72f9c7e512 342b9c55 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/18 05:50 upstream 06dc10eae55b 342b9c55 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/18 02:44 upstream 06dc10eae55b 342b9c55 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/17 05:44 upstream 213f891525c2 342b9c55 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/16 04:09 upstream fbe1bf1e5ff1 f757a323 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/15 15:45 upstream 9a3dad63edbe f757a323 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/15 10:22 upstream 9a3dad63edbe f757a323 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/15 02:01 upstream 70f8c6f8f880 f757a323 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/14 23:07 upstream 70f8c6f8f880 f757a323 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/14 17:54 upstream 727fb8376504 6388bc36 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in bcmp
2023/10/13 23:34 upstream 10a6e5feccb8 f757a323 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/13 18:55 upstream 10a6e5feccb8 f757a323 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/13 10:45 upstream e8c127b05766 6388bc36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/12 16:36 upstream 401644852d0b 1b231e3c .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/12 11:38 upstream 401644852d0b 83165b57 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in bcmp
2023/10/12 10:06 upstream 8182d7a3f1b8 83165b57 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in bcmp
2023/10/10 06:25 upstream 94f6f0550c62 c9be5398 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/09 20:32 upstream 94f6f0550c62 3c53c7d9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/08 14:08 upstream b9ddbb0cde2a 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/08 12:16 upstream b9ddbb0cde2a 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/07 03:46 upstream b78b18fb8ee1 ea12a918 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in bcmp
2023/10/07 01:42 upstream 7de25c855b63 ea12a918 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/06 10:23 upstream b78b18fb8ee1 db17ad9f .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/05 07:10 upstream ba7d997a2a29 b7d7ff54 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/04 21:27 upstream cbf3a2cb156a b7d7ff54 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/04 20:23 upstream cbf3a2cb156a b7d7ff54 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in bcmp
2023/10/04 11:51 upstream cbf3a2cb156a b7d7ff54 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in bcmp
2023/10/20 11:37 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 78124b0c1d10 a42250d2 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/18 10:00 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci c295ba49917a 342b9c55 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/14 19:59 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 249eb8f39efb 6388bc36 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/12 18:56 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 19af4a4ed414 fc170927 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/11 02:39 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 19af4a4ed414 83165b57 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/09 09:25 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 19af4a4ed414 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/09 07:55 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 19af4a4ed414 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/09 02:21 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 19af4a4ed414 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/08 20:35 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 19af4a4ed414 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/08 17:03 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 19af4a4ed414 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/08 00:30 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 19af4a4ed414 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/07 21:25 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 19af4a4ed414 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/07 10:37 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 19af4a4ed414 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/06 19:05 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci ed4d3054d499 ea12a918 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/06 17:36 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci ed4d3054d499 ea12a918 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/06 14:16 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci ed4d3054d499 db17ad9f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/05 21:03 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 2e530aeb342b db17ad9f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/05 18:54 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 2e530aeb342b db17ad9f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/10/04 13:49 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 2e530aeb342b b7d7ff54 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in bcmp
2023/12/18 00:45 upstream 0e389834672c 3222d10c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kmsan-gce KMSAN: uninit-value in bcmp
2023/11/17 10:11 upstream 7475e51b8796 cb976f63 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kmsan-gce KMSAN: uninit-value in bcmp
2023/12/11 10:25 upstream a39b6ac3781d 28b24332 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kmsan-gce-386 KMSAN: uninit-value in bcmp
2023/12/03 11:22 upstream 1b8af6552cb7 f819d6f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kmsan-gce-386 KMSAN: uninit-value in bcmp
2023/11/25 07:58 upstream fa2b906f5148 5b429f39 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kmsan-gce-386 KMSAN: uninit-value in bcmp
2023/08/29 18:55 upstream f97e18a3f2fb ce731e62 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in bcmp
2023/08/22 08:37 upstream f7757129e3de 6b415825 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: out-of-bounds Read in bcmp
2023/07/24 11:56 upstream 6eaae1980760 06460670 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kmsan-gce-386 KMSAN: uninit-value in bcmp
* Struck through repros no longer work on HEAD.