[v6.1] KASAN: slab-out-of-bounds Read in ntfs_readdir

0 views
Skip to first unread message

syzbot

unread,
Jun 7, 2023, 11:22:56 AM6/7/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 76ba310227d2 Linux 6.1.32
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16174d2b280000
kernel config: https://syzkaller.appspot.com/x/.config?x=3d054c5c4a3e2d63
dashboard link: https://syzkaller.appspot.com/bug?extid=02aeb7d7ae74bfc46e38
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/e0c868320bc7/disk-76ba3102.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f7fcc207e1e7/vmlinux-76ba3102.xz
kernel image: https://storage.googleapis.com/syzbot-assets/5ddc172b4acf/Image-76ba3102.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+02aeb7...@syzkaller.appspotmail.com

ntfs: (device loop3): load_system_files(): Failed to determine if Windows is hibernated. Will not be able to remount read-write. Run chkdsk.
==================================================================
BUG: KASAN: slab-out-of-bounds in ntfs_filldir fs/ntfs/dir.c:1021 [inline]
BUG: KASAN: slab-out-of-bounds in ntfs_readdir+0xb00/0x2be8 fs/ntfs/dir.c:1200
Read of size 1 at addr ffff0000cf164871 by task syz-executor.3/14145

CPU: 0 PID: 14145 Comm: syz-executor.3 Not tainted 6.1.32-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x174/0x4c0 mm/kasan/report.c:395
kasan_report+0xd4/0x130 mm/kasan/report.c:495
__asan_report_load1_noabort+0x2c/0x38 mm/kasan/report_generic.c:348
ntfs_filldir fs/ntfs/dir.c:1021 [inline]
ntfs_readdir+0xb00/0x2be8 fs/ntfs/dir.c:1200
iterate_dir+0x1f4/0x4e4
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64 fs/readdir.c:354 [inline]
__arm64_sys_getdents64+0x1c4/0x4a0 fs/readdir.c:354
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

Allocated by task 14145:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:211 [inline]
__do_kmalloc_node mm/slab_common.c:955 [inline]
__kmalloc+0xd8/0x1c4 mm/slab_common.c:968
kmalloc include/linux/slab.h:558 [inline]
ntfs_readdir+0x65c/0x2be8 fs/ntfs/dir.c:1162
iterate_dir+0x1f4/0x4e4
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64 fs/readdir.c:354 [inline]
__arm64_sys_getdents64+0x1c4/0x4a0 fs/readdir.c:354
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

Last potentially related work creation:
kasan_save_stack+0x40/0x70 mm/kasan/common.c:45
__kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:486
kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:496
kvfree_call_rcu+0xb4/0x714 kernel/rcu/tree.c:3344
kernfs_unlink_open_file+0x398/0x448 fs/kernfs/file.c:629
kernfs_fop_release+0x130/0x198 fs/kernfs/file.c:801
__fput+0x30c/0x7bc fs/file_table.c:320
____fput+0x20/0x30 fs/file_table.c:348
task_work_run+0x240/0x2f0 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
do_notify_resume+0x2144/0x3470 arch/arm64/kernel/signal.c:1132
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

The buggy address belongs to the object at ffff0000cf164800
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 113 bytes inside of
128-byte region [ffff0000cf164800, ffff0000cf164880)

The buggy address belongs to the physical page:
page:000000001d7dc91d refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10f164
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 fffffc000370c380 dead000000000004 ffff0000c0002300
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000cf164700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000cf164780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000cf164800: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
^
ffff0000cf164880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000cf164900: 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Jun 7, 2023, 11:39:14 AM6/7/23
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 76ba310227d2 Linux 6.1.32
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1383091d280000
kernel config: https://syzkaller.appspot.com/x/.config?x=3d054c5c4a3e2d63
dashboard link: https://syzkaller.appspot.com/bug?extid=02aeb7d7ae74bfc46e38
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12697e1b280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1666f91d280000
mounted in repro: https://storage.googleapis.com/syzbot-assets/dfe294a53107/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+02aeb7...@syzkaller.appspotmail.com

ntfs: (device loop0): load_system_files(): Failed to determine if Windows is hibernated. Will not be able to remount read-write. Run chkdsk.
==================================================================
BUG: KASAN: slab-out-of-bounds in ntfs_filldir fs/ntfs/dir.c:1021 [inline]
BUG: KASAN: slab-out-of-bounds in ntfs_readdir+0xb00/0x2be8 fs/ntfs/dir.c:1200
Read of size 1 at addr ffff0000c402f371 by task syz-executor175/4215

CPU: 1 PID: 4215 Comm: syz-executor175 Not tainted 6.1.32-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x174/0x4c0 mm/kasan/report.c:395
kasan_report+0xd4/0x130 mm/kasan/report.c:495
__asan_report_load1_noabort+0x2c/0x38 mm/kasan/report_generic.c:348
ntfs_filldir fs/ntfs/dir.c:1021 [inline]
ntfs_readdir+0xb00/0x2be8 fs/ntfs/dir.c:1200
iterate_dir+0x1f4/0x4e4
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64 fs/readdir.c:354 [inline]
__arm64_sys_getdents64+0x1c4/0x4a0 fs/readdir.c:354
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

Allocated by task 4215:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:211 [inline]
__do_kmalloc_node mm/slab_common.c:955 [inline]
__kmalloc+0xd8/0x1c4 mm/slab_common.c:968
kmalloc include/linux/slab.h:558 [inline]
ntfs_readdir+0x65c/0x2be8 fs/ntfs/dir.c:1162
iterate_dir+0x1f4/0x4e4
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64 fs/readdir.c:354 [inline]
__arm64_sys_getdents64+0x1c4/0x4a0 fs/readdir.c:354
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

The buggy address belongs to the object at ffff0000c402f300
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 113 bytes inside of
128-byte region [ffff0000c402f300, ffff0000c402f380)

The buggy address belongs to the physical page:
page:00000000729a9d4d refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10402f
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 dead000000000100 dead000000000122 ffff0000c0002300
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000c402f200: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000c402f280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000c402f300: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
^
ffff0000c402f380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000c402f400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
Reply all
Reply to author
Forward
0 new messages