syzbot


KASAN: use-after-free Read in ext4_rename_dir_prepare

Status: upstream: reported C repro on 2022/11/19 04:34
Reported-by: syzbot+536f81eebdd35bd6d6ac@syzkaller.appspotmail.com
First crash: 575d, last: 479d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Read in ext4_rename_dir_prepare C error 2 540d 575d 2/2 fixed on 2023/01/17 16:18
android-5-10 KASAN: use-after-free Read in ext4_rename_dir_prepare (3) C error 4 412d 412d 2/2 fixed on 2023/05/08 19:06
android-5-10 KASAN: use-after-free Read in ext4_rename_dir_prepare (2) C error inconclusive 3 479d 479d 2/2 fixed on 2023/03/28 17:56

Sample crash report:
EXT4-fs (loop0): mounting with "discard" option, but the device does not support discard
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop0): mounting with "discard" option, but the device does not support discard
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
==================================================================
BUG: KASAN: use-after-free in ext4_rename_dir_prepare+0x3a6/0x440 fs/ext4/namei.c:3381
Read of size 4 at addr ffff88808f155e02 by task syz-executor413/8142

CPU: 0 PID: 8142 Comm: syz-executor413 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 mm/kasan/report.c:412 [inline]
 __asan_report_load4_noabort+0x88/0x90 mm/kasan/report.c:432
 ext4_rename_dir_prepare+0x3a6/0x440 fs/ext4/namei.c:3381
 ext4_cross_rename+0x112f/0x14f0 fs/ext4/namei.c:3859
 ext4_rename2+0x1be/0x210 fs/ext4/namei.c:3938
 vfs_rename+0x67e/0x1bc0 fs/namei.c:4479
 do_renameat2+0xb59/0xc70 fs/namei.c:4629
 __do_sys_renameat2 fs/namei.c:4664 [inline]
 __se_sys_renameat2 fs/namei.c:4661 [inline]
 __x64_sys_renameat2+0xba/0x150 fs/namei.c:4661
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f7fd68de709
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:00007ffd44b239b8 EFLAGS: 00000246 ORIG_RAX: 000000000000013c
RAX: ffffffffffffffda RBX: 00007f7fd6923ee0 RCX: 00007f7fd68de709
RDX: 00000000ffffff9c RSI: 00000000200004c0 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000002 R09: 00007ffd44b239e0
R10: 0000000020000000 R11: 0000000000000246 R12: 00007ffd44b239dc
R13: 00007ffd44b23a10 R14: 00007ffd44b239f0 R15: 0000000000000001

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

Memory state around the buggy address:
 ffff88808f155d00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88808f155d80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88808f155e00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88808f155e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88808f155f00: 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/19 04:33 linux-4.19.y 3f8a27f9e27b 5bb70014 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: use-after-free Read in ext4_rename_dir_prepare
2023/02/23 00:02 linux-4.19.y 3f8a27f9e27b 9f1e2cb3 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: slab-out-of-bounds Read in ext4_rename_dir_prepare
* Struck through repros no longer work on HEAD.