KASAN: use-after-free Read in reiserfs_release_objectid

Status: upstream: reported C repro on 2022/11/28 17:34
Subsystems: reiserfs
[Documentation on labels]
First crash: 501d, last: 425d
Fix bisection: failed (error log, bisect log)
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in reiserfs_release_objectid C 1 408d 495d 0/1 upstream: reported C repro on 2022/12/04 21:28
linux-6.1 KASAN: use-after-free Read in reiserfs_release_objectid 1 370d 370d 0/3 auto-obsoleted due to no activity on 2023/08/07 07:31
upstream KASAN: use-after-free Read in reiserfs_release_objectid reiserfs C error done 6 99d 501d 0/26 upstream: reported C repro on 2022/11/29 10:22

Sample crash report:
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
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
BUG: KASAN: use-after-free in memmove include/linux/string.h:392 [inline]
BUG: KASAN: use-after-free in reiserfs_release_objectid+0x47e/0x740 fs/reiserfs/objectid.c:165
Read of size 14568 at addr ffff88809006a0d0 by task syz-executor387/8181

CPU: 1 PID: 8181 Comm: syz-executor387 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report+0x8f/0xa0 mm/kasan/report.c:412
 memmove+0x20/0x50 mm/kasan/kasan.c:293
 memmove include/linux/string.h:392 [inline]
 reiserfs_release_objectid+0x47e/0x740 fs/reiserfs/objectid.c:165
 remove_save_link+0x21c/0x3f0 fs/reiserfs/super.c:542
 reiserfs_evict_inode+0x489/0x540 fs/reiserfs/inode.c:91
 evict+0x2ed/0x760 fs/inode.c:559
 iput_final fs/inode.c:1555 [inline]
 iput+0x4f1/0x860 fs/inode.c:1581
 dentry_unlink_inode+0x265/0x320 fs/dcache.c:374
 __dentry_kill+0x3c0/0x640 fs/dcache.c:566
 dentry_kill+0xc4/0x510 fs/dcache.c:685
 dput+0x55f/0x640 fs/dcache.c:846
 do_renameat2+0xb69/0xc70 fs/namei.c:4633
 __do_sys_rename fs/namei.c:4675 [inline]
 __se_sys_rename fs/namei.c:4673 [inline]
 __x64_sys_rename+0x5d/0x80 fs/namei.c:4673
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
RIP: 0033:0x7f9ed81e0989
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 90 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:00007fffdaa63988 EFLAGS: 00000246 ORIG_RAX: 0000000000000052
RAX: ffffffffffffffda RBX: 0031656c69662f2e RCX: 00007f9ed81e0989
RDX: 00007f9ed81e0989 RSI: 0000000020000200 RDI: 0000000020000140
RBP: 0000000000000000 R08: 00007fffdaa639b0 R09: 00007fffdaa639b0
R10: 00007fffdaa639b0 R11: 0000000000000246 R12: 00007fffdaa639ac
R13: 00007fffdaa639e0 R14: 00007fffdaa639c0 R15: 000000000000000a

The buggy address belongs to the page:
page:ffffea0002401a80 count:2 mapcount:0 mapping:ffff8880addcc560 index:0x10
flags: 0xfff0000001106c(referenced|uptodate|lru|active|private|mappedtodisk)
raw: 00fff0000001106c ffffea0002290408 ffffea0002d3c848 ffff8880addcc560
raw: 0000000000000010 ffff88808ac4c498 00000002ffffffff ffff8880b59f68c0
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809006af00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88809006af80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88809006b000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88809006b080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88809006b100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/11/28 17:34 linux-4.19.y 3f8a27f9e27b 247de55b .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: use-after-free Read in reiserfs_release_objectid
2023/02/12 18:37 linux-4.19.y 3f8a27f9e27b 93e26d60 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: slab-out-of-bounds Read in reiserfs_release_objectid
* Struck through repros no longer work on HEAD.