[v5.15] KASAN: use-after-free Read in ntfs_iget5

1 view
Skip to first unread message

syzbot

unread,
Apr 23, 2023, 6:29:00 AM4/23/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3299fb36854f Linux 5.15.108
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11f6b2bfc80000
kernel config: https://syzkaller.appspot.com/x/.config?x=108ad532b7717ab6
dashboard link: https://syzkaller.appspot.com/bug?extid=127bb5d8ccc2445427a0
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5f08ed196f7f/disk-3299fb36.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/7f30a6b0d826/vmlinux-3299fb36.xz
kernel image: https://storage.googleapis.com/syzbot-assets/07102113a249/bzImage-3299fb36.xz

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

loop4: detected capacity change from 0 to 4096
ntfs3: loop4: Different NTFS' sector size (1024) and media sector size (512)
==================================================================
BUG: KASAN: use-after-free in ntfs_read_mft fs/ntfs3/inode.c:155 [inline]
BUG: KASAN: use-after-free in ntfs_iget5+0x17d8/0x3760 fs/ntfs3/inode.c:517
Read of size 8 at addr ffff8880799ea036 by task syz-executor.4/19257

CPU: 1 PID: 19257 Comm: syz-executor.4 Not tainted 5.15.108-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
ntfs_read_mft fs/ntfs3/inode.c:155 [inline]
ntfs_iget5+0x17d8/0x3760 fs/ntfs3/inode.c:517
ntfs_loadlog_and_replay+0x179/0x530 fs/ntfs3/fsntfs.c:272
ntfs_fill_super+0x24d2/0x4450 fs/ntfs3/super.c:1013
get_tree_bdev+0x3fe/0x620 fs/super.c:1303
vfs_get_tree+0x88/0x270 fs/super.c:1508
do_new_mount+0x28b/0xad0 fs/namespace.c:2994
do_mount fs/namespace.c:3337 [inline]
__do_sys_mount fs/namespace.c:3545 [inline]
__se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3522
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f6564e1269a
Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6563382f88 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 000000000001f804 RCX: 00007f6564e1269a
RDX: 000000002001f800 RSI: 000000002001f840 RDI: 00007f6563382fe0
RBP: 00007f6563383020 R08: 00007f6563383020 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 000000002001f800
R13: 000000002001f840 R14: 00007f6563382fe0 R15: 000000002001f880
</TASK>

Allocated by task 2958:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
__kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
getname_flags+0xb8/0x4e0 fs/namei.c:138
user_path_at_empty+0x2a/0x180 fs/namei.c:2852
user_path_at include/linux/namei.h:57 [inline]
vfs_statx+0x106/0x3b0 fs/stat.c:221
vfs_fstatat fs/stat.c:243 [inline]
__do_sys_newfstatat fs/stat.c:411 [inline]
__se_sys_newfstatat fs/stat.c:405 [inline]
__x64_sys_newfstatat+0x12c/0x1b0 fs/stat.c:405
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 2958:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1705 [inline]
slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
putname fs/namei.c:270 [inline]
user_path_at_empty+0x12b/0x180 fs/namei.c:2855
user_path_at include/linux/namei.h:57 [inline]
vfs_statx+0x106/0x3b0 fs/stat.c:221
vfs_fstatat fs/stat.c:243 [inline]
__do_sys_newfstatat fs/stat.c:411 [inline]
__se_sys_newfstatat fs/stat.c:405 [inline]
__x64_sys_newfstatat+0x12c/0x1b0 fs/stat.c:405
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff8880799e9100
which belongs to the cache names_cache of size 4096
The buggy address is located 3894 bytes inside of
4096-byte region [ffff8880799e9100, ffff8880799ea100)
The buggy address belongs to the page:
page:ffffea0001e67a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x799e8
head:ffffea0001e67a00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888011dc6500
raw: 0000000000000000 0000000000070007 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 2592, ts 2110939881347, free_ts 2106568188001
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5421
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
getname_flags+0xb8/0x4e0 fs/namei.c:138
do_sys_openat2+0xd2/0x500 fs/open.c:1205
do_sys_open fs/open.c:1227 [inline]
__do_sys_openat fs/open.c:1243 [inline]
__se_sys_openat fs/open.c:1238 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1238
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
free_slab mm/slub.c:2015 [inline]
discard_slab mm/slub.c:2021 [inline]
__unfreeze_partials+0x1b7/0x210 mm/slub.c:2507
put_cpu_partial+0x132/0x1a0 mm/slub.c:2587
do_slab_free mm/slub.c:3487 [inline]
___cache_free+0xe3/0x100 mm/slub.c:3506
qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
getname_flags+0xb8/0x4e0 fs/namei.c:138
user_path_at_empty+0x2a/0x180 fs/namei.c:2852
do_readlinkat+0x114/0x3a0 fs/stat.c:442
__do_sys_readlink fs/stat.c:475 [inline]
__se_sys_readlink fs/stat.c:472 [inline]
__x64_sys_readlink+0x7b/0x90 fs/stat.c:472
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb

Memory state around the buggy address:
ffff8880799e9f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880799e9f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880799ea000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880799ea080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880799ea100: fc fc fc fc 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.

syzbot

unread,
Dec 20, 2023, 6:31:14 AM12/20/23
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages