syzbot


KASAN: use-after-free Read in ext4_ext_rm_leaf

Status: fixed on 2023/05/24 12:43
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+3ea2b85f9c3f27b8399f@syzkaller.appspotmail.com
Fix commit: 3967d330baf2 ext4: add inode table check in __ext4_get_inode_loc to aovid possible infinite loop
First crash: 671d, last: 671d
Cause bisection: failed (error log, bisect log)
  
Fix bisection the fix commit could be any of (bisect log):
  416c4356f372 Merge 5.10.161 into android12-5.10-lts
  b34e092097a7 Revert "nvmem: core: Fix a conflict between MTD and NVMEM on wp-gpios property"
  
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Read in ext4_ext_rm_leaf ext4 C error done 1 671d 671d 2/2 fixed on 2023/05/24 12:43

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ext4_ext_rm_leaf+0x153c/0x18c0 fs/ext4/extents.c:2614
Read of size 4 at addr ffff88811f789ff4 by task syz-executor399/4162

CPU: 0 PID: 4162 Comm: syz-executor399 Not tainted 5.10.161-syzkaller-00019-g416c4356f372 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3c0 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
 ext4_ext_rm_leaf+0x153c/0x18c0 fs/ext4/extents.c:2614
 ext4_ext_remove_space+0xf25/0x22a0 fs/ext4/extents.c:2952
 ext4_ext_truncate+0x18a/0x210 fs/ext4/extents.c:4413
 ext4_truncate+0xba0/0x1270 fs/ext4/inode.c:4356
 ext4_setattr+0xf7b/0x17f0 fs/ext4/inode.c:5599
 notify_change+0xb76/0xe10 fs/attr.c:338
 do_truncate+0x1ea/0x2d0 fs/open.c:65
 handle_truncate fs/namei.c:2991 [inline]
 do_open fs/namei.c:3333 [inline]
 path_openat+0x294e/0x2fd0 fs/namei.c:3448
 do_filp_open+0x200/0x440 fs/namei.c:3475
 do_sys_openat2+0x13b/0x470 fs/open.c:1211
 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_64+0x34/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xc6
RIP: 0033:0x7f64ff0b87f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 71 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f64f6d432f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f64ff13d7b0 RCX: 00007f64ff0b87f9
RDX: 000000000000275a RSI: 00000000200001c0 RDI: 00000000ffffff9c
RBP: 00007f64ff10a814 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: be734677a9d9a8be
R13: 0030656c69662f2e R14: 6f6f6c2f7665642f R15: 00007f64ff13d7b8

The buggy address belongs to the page:
page:ffffea00047de240 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11f789
flags: 0x8000000000000000()
raw: 8000000000000000 ffffea00047de248 ffffea00047de248 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner info is not present (never set?)

Memory state around the buggy address:
 ffff88811f789e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88811f789f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88811f789f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                                             ^
 ffff88811f78a000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88811f78a080: 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/01/21 14:05 android12-5.10-lts 416c4356f372 cc0f9968 .config strace log report syz C [mounted in repro] ci2-android-5-10 KASAN: use-after-free Read in ext4_ext_rm_leaf
* Struck through repros no longer work on HEAD.