syzbot


KASAN: use-after-free Read in reiserfs_find_entry

Status: upstream: reported C repro on 2023/02/16 03:16
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+0de9a97f56ec4f3cfc58@syzkaller.appspotmail.com
First crash: 674d, last: 674d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in reiserfs_find_entry origin:upstream missing-backport C error 4 4d01h 605d 0/3 upstream: reported C repro on 2023/04/26 06:52
linux-6.1 KASAN: use-after-free Read in reiserfs_find_entry origin:upstream missing-backport C 3 12d 566d 0/3 upstream: reported C repro on 2023/06/03 22:29
upstream BUG: unable to handle kernel NULL pointer dereference in reiserfs_find_entry reiserfs C error done 25 358d 795d 25/28 fixed on 2024/02/02 11:15

Sample crash report:
reiserfs: using flush barriers
REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using r5 hash to sort names
==================================================================
BUG: KASAN: use-after-free in strlen+0x79/0x90 lib/string.c:539
Read of size 1 at addr ffff88808e4460c4 by task syz-executor347/7973

CPU: 0 PID: 7973 Comm: syz-executor347 Not tainted 4.14.305-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:251
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:350
 kasan_report mm/kasan/report.c:408 [inline]
 __asan_report_load1_noabort+0x68/0x70 mm/kasan/report.c:426
 strlen+0x79/0x90 lib/string.c:539
 strlen include/linux/string.h:298 [inline]
 set_de_name_and_namelen fs/reiserfs/namei.c:82 [inline]
 linear_search_in_dir_item fs/reiserfs/namei.c:261 [inline]
 reiserfs_find_entry.part.0+0x4ae/0x11e0 fs/reiserfs/namei.c:330
 reiserfs_find_entry fs/reiserfs/namei.c:367 [inline]
 reiserfs_lookup+0x1fd/0x400 fs/reiserfs/namei.c:367
 lookup_real fs/namei.c:1555 [inline]
 __lookup_hash fs/namei.c:1575 [inline]
 __lookup_hash+0x1bb/0x270 fs/namei.c:1563
 lookup_one_len+0x279/0x3a0 fs/namei.c:2539
 reiserfs_lookup_privroot+0x92/0x270 fs/reiserfs/xattr.c:970
 reiserfs_fill_super+0x1772/0x2990 fs/reiserfs/super.c:2199
 mount_bdev+0x2b3/0x360 fs/super.c:1134
 mount_fs+0x92/0x2a0 fs/super.c:1237
 vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2572 [inline]
 do_mount+0xe65/0x2a30 fs/namespace.c:2905
 SYSC_mount fs/namespace.c:3121 [inline]
 SyS_mount+0xa8/0x120 fs/namespace.c:3098
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3
RIP: 0033:0x7f6d5c9c9d2a
RSP: 002b:00007ffce29fd7f8 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00005555563062c0 RCX: 00007f6d5c9c9d2a
RDX: 00000000200000c0 RSI: 0000000020000040 RDI: 00007ffce29fd840
RBP: 0000000000000000 R08: 00007ffce29fd880 R09: 0000000000000030
R10: 0000000000008001 R11: 0000000000000286 R12: 0000000000000004
R13: 00007ffce29fd880 R14: 0000000000000003 R15: 00007ffce29fd840

The buggy address belongs to the page:
page:ffffea0002391180 count:0 mapcount:0 mapping:          (null) index:0x1
flags: 0xfff00000000000()
raw: 00fff00000000000 0000000000000000 0000000000000001 00000000ffffffff
raw: ffffea0002320aa0 ffffea00023911e0 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808e445f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88808e446000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88808e446080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                           ^
 ffff88808e446100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88808e446180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/16 03:16 linux-4.14.y a8ad60f2af58 6be0f1f5 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-4-14 KASAN: use-after-free Read in reiserfs_find_entry
* Struck through repros no longer work on HEAD.