syzbot


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

Status: fixed on 2023/02/24 13:50
Subsystems: ntfs3
[Documentation on labels]
Reported-by: syzbot+b892240eac461e488d51@syzkaller.appspotmail.com
Fix commit: 557d19675a47 fs/ntfs3: Fix slab-out-of-bounds read in ntfs_trim_fs
First crash: 575d, last: 477d
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 ntfs_trim_fs (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] fs/ntfs3: Fix slab-out-of-bounds read in ntfs_trim_fs 2 (2) 2022/11/12 18:06
[syzbot] KASAN: slab-out-of-bounds Read in ntfs_trim_fs 0 (2) 2022/10/02 20:04
Last patch testing requests (2)
Created Duration User Patch Repo Result
2022/10/03 09:08 10m kari.argillander@gmail.com https://github.com/Paragon-Software-Group/linux-ntfs3.git master report log
2022/10/01 05:04 12m abdun.nihaal@gmail.com patch upstream report log

Sample crash report:
loop0: detected capacity change from 0 to 8226
ntfs3: loop0: Mark volume as dirty due to NTFS errors
ntfs3: loop0: Failed to load $Extend.
==================================================================
BUG: KASAN: slab-out-of-bounds in ntfs_trim_fs+0x84b/0x940 fs/ntfs3/bitmap.c:1434
Read of size 2 at addr ffff888016aa86a0 by task syz-executor111/3605

CPU: 1 PID: 3605 Comm: syz-executor111 Not tainted 6.1.0-rc2-syzkaller-00105-gb229b6ca5abb #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/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:284 [inline]
 print_report+0x15e/0x45d mm/kasan/report.c:395
 kasan_report+0xbb/0x1f0 mm/kasan/report.c:495
 ntfs_trim_fs+0x84b/0x940 fs/ntfs3/bitmap.c:1434
 ntfs_ioctl_fitrim+0x23e/0x340 fs/ntfs3/file.c:40
 ntfs_ioctl+0x9c/0xd0 fs/ntfs3/file.c:57
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl fs/ioctl.c:856 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856
 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:0x7f7fa72ec559
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:00007ffd82dba828 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f7fa72ec559
RDX: 0000000020000040 RSI: 00000000c0185879 RDI: 0000000000000003
RBP: 00007ffd82dba830 R08: 6c616b7a79732f2e R09: 6c616b7a79732f2e
R10: 00005555565dd2c0 R11: 0000000000000246 R12: 00007f7fa72abd60
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 1:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45
 kasan_set_track+0x21/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:371 [inline]
 ____kasan_kmalloc mm/kasan/common.c:330 [inline]
 __kasan_kmalloc+0xa1/0xb0 mm/kasan/common.c:380
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:955 [inline]
 __kmalloc_node_track_caller+0x55/0xc0 mm/slab_common.c:975
 kstrdup+0x3b/0x70 mm/util.c:61
 kstrdup_const+0x53/0x80 mm/util.c:84
 __kernfs_new_node+0x9d/0x8b0 fs/kernfs/dir.c:599
 kernfs_new_node fs/kernfs/dir.c:665 [inline]
 kernfs_create_dir_ns+0x9c/0x220 fs/kernfs/dir.c:1011
 sysfs_create_dir_ns+0x127/0x290 fs/sysfs/dir.c:59
 create_dir lib/kobject.c:63 [inline]
 kobject_add_internal+0x2c9/0x8f0 lib/kobject.c:223
 kobject_add_varg lib/kobject.c:358 [inline]
 kobject_add+0x150/0x1c0 lib/kobject.c:410
 device_add+0x368/0x1e90 drivers/base/core.c:3452
 register_cpu+0x313/0x4c0 drivers/base/cpu.c:377
 topology_init+0x86/0x91 arch/x86/kernel/topology.c:158
 do_one_initcall+0x13d/0x780 init/main.c:1303
 do_initcall_level init/main.c:1376 [inline]
 do_initcalls init/main.c:1392 [inline]
 do_basic_setup init/main.c:1411 [inline]
 kernel_init_freeable+0x6ff/0x788 init/main.c:1631
 kernel_init+0x1a/0x1d0 init/main.c:1519
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

The buggy address belongs to the object at ffff888016aa8690
 which belongs to the cache kmalloc-8 of size 8
The buggy address is located 8 bytes to the right of
 8-byte region [ffff888016aa8690, ffff888016aa8698)

The buggy address belongs to the physical page:
page:ffffea00005aaa00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x16aa8
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00005d6440 dead000000000002 ffff888011841280
raw: 0000000000000000 0000000080660066 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, tgid 1 (swapper/0), ts 1417483201, free_ts 0
 prep_new_page mm/page_alloc.c:2538 [inline]
 get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4287
 __alloc_pages+0x1c7/0x5a0 mm/page_alloc.c:5554
 alloc_page_interleave+0x1e/0x200 mm/mempolicy.c:2118
 alloc_pages+0x22f/0x270 mm/mempolicy.c:2280
 alloc_slab_page mm/slub.c:1794 [inline]
 allocate_slab+0x213/0x300 mm/slub.c:1939
 new_slab mm/slub.c:1992 [inline]
 ___slab_alloc+0xa91/0x1400 mm/slub.c:3180
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x191/0x3e0 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:954 [inline]
 __kmalloc_node_track_caller+0x45/0xc0 mm/slab_common.c:975
 kstrdup+0x3b/0x70 mm/util.c:61
 kstrdup_const+0x53/0x80 mm/util.c:84
 __kernfs_new_node+0x9d/0x8b0 fs/kernfs/dir.c:599
 kernfs_new_node fs/kernfs/dir.c:665 [inline]
 kernfs_create_dir_ns+0x9c/0x220 fs/kernfs/dir.c:1011
 sysfs_create_dir_ns+0x127/0x290 fs/sysfs/dir.c:59
 create_dir lib/kobject.c:63 [inline]
 kobject_add_internal+0x2c9/0x8f0 lib/kobject.c:223
 kobject_add_varg lib/kobject.c:358 [inline]
 kobject_add+0x150/0x1c0 lib/kobject.c:410
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888016aa8580: fc fc fc fc 02 fc fc fc fc fa fc fc fc fc 00 fc
 ffff888016aa8600: fc fc fc 00 fc fc fc fc 05 fc fc fc fc 05 fc fc
>ffff888016aa8680: fc fc 05 fc fc fc fc 05 fc fc fc fc 05 fc fc fc
                               ^
 ffff888016aa8700: fc 06 fc fc fc fc 05 fc fc fc fc 05 fc fc fc fc
 ffff888016aa8780: 05 fc fc fc fc 05 fc fc fc fc 06 fc fc fc fc 07
==================================================================

Crashes (204):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/10/31 10:20 upstream b229b6ca5abb 2a71366b .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/10/22 00:05 upstream 6d36c728bc2e 63e790dd .config strace log report syz C [disk image] [vmlinux] [mounted in repro] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/10/09 15:09 upstream a6afa4199d3d aea5da89 .config strace log report syz C [disk image] [vmlinux] [mounted in repro] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/10/03 21:44 upstream 4fe89d07dcc2 feb56351 .config strace log report syz C [disk image] [vmlinux] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/09/27 21:28 upstream a1375562c0a8 87840e00 .config strace log report syz C [disk image] [vmlinux] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/09/26 21:29 upstream f76349cf4145 d59ba983 .config strace log report syz C ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/11/05 05:52 linux-next 0cdb3579f1ee 6d752409 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/21 22:57 upstream b6bb9676f216 4067838e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/20 01:21 upstream aeba12b26c79 c52b2efb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/19 14:12 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/19 05:19 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/19 03:28 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/18 14:24 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/18 11:20 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/18 02:48 upstream 75caf5940899 05494336 .config console log report info ci-qemu-upstream KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/17 21:27 upstream 77856d911a8c 05494336 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/17 08:16 upstream 84e57d292203 05494336 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/16 19:43 upstream 84e57d292203 05494336 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/16 06:36 upstream 041fae9c105a 6f9c033e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/16 03:05 upstream 041fae9c105a 6f9c033e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/16 00:53 upstream 041fae9c105a 6f9c033e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/15 23:39 upstream 041fae9c105a 6f9c033e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/15 18:01 upstream 041fae9c105a 6f9c033e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/15 08:14 upstream e2ca6ba6ba01 b18f0a64 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/14 22:43 upstream e2ca6ba6ba01 b18f0a64 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/14 21:14 upstream e2ca6ba6ba01 b18f0a64 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/14 06:27 upstream 02bf43c7b7f7 f6511626 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/14 03:21 upstream 02bf43c7b7f7 f6511626 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/13 23:25 upstream 02bf43c7b7f7 f6511626 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/13 14:57 upstream 764822972d64 67be1ae7 .config console log report info ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/13 08:13 upstream 3a28c2c89f4b 67be1ae7 .config console log report info ci-upstream-kasan-gce-selinux-root KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/13 06:27 upstream 830b3c68c1fb 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/13 00:10 upstream 830b3c68c1fb 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/12 13:20 upstream 4cee37b3a4e6 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/12 11:12 upstream 830b3c68c1fb 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/12 06:47 upstream 4cee37b3a4e6 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/12 03:23 upstream 4cee37b3a4e6 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/11 16:51 upstream 4cee37b3a4e6 67be1ae7 .config console log report info ci-upstream-kasan-gce-smack-root KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/11 11:08 upstream 296a7b7eb792 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/11 08:51 upstream 296a7b7eb792 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/11 08:07 upstream 296a7b7eb792 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/10 18:57 upstream 3ecc37918c80 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/10 14:31 upstream 3ecc37918c80 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/10 12:12 upstream 3ecc37918c80 67be1ae7 .config console log report info ci-upstream-kasan-gce-smack-root KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/10 01:22 upstream 0d1409e4ff08 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/09 23:30 upstream 0d1409e4ff08 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/09 20:44 upstream 0d1409e4ff08 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/09 08:25 upstream f3e8416619ce 1034e5fa .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/08 19:12 upstream 479174d402bc 1034e5fa .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/08 10:52 upstream 479174d402bc d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/07 21:03 upstream 8ed710da2873 d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/07 16:28 upstream 8ed710da2873 d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/07 13:01 upstream 8ed710da2873 d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/07 03:15 upstream 8ed710da2873 d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/11 15:25 upstream 4cee37b3a4e6 67be1ae7 .config console log report info ci-qemu-upstream-386 KASAN: slab-out-of-bounds Read in ntfs_trim_fs
2022/12/10 12:21 upstream 3ecc37918c80 67be1ae7 .config console log report info ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in ntfs_trim_fs
2022/12/10 12:19 upstream 3ecc37918c80 67be1ae7 .config console log report info ci-qemu-upstream KASAN: use-after-free Read in ntfs_trim_fs
2023/01/03 05:08 https://github.com/google/kmsan.git master 5c6259d6d19f ab32d508 .config console log report info ci-upstream-kmsan-gce-386 KMSAN: uninit-value in ntfs_trim_fs
2022/11/22 05:38 https://github.com/google/kmsan.git master 6b3059a0a074 1c576c23 .config console log report info ci-upstream-kmsan-gce-386 KMSAN: uninit-value in ntfs_trim_fs
* Struck through repros no longer work on HEAD.