syzbot


KASAN: use-after-free Read in ext4_xattr_inode_dec_ref_all

Status: upstream: reported C repro on 2025/03/27 11:49
Reported-by: syzbot+786264827f156d1819c6@syzkaller.appspotmail.com
First crash: 14d, last: 1d00h

Sample crash report:
EXT4-fs error (device loop1): ext4_xattr_inode_iget:409: comm syz-executor600: error while reading EA inode 4263244710 err=-117
==================================================================
BUG: KASAN: use-after-free in ext4_xattr_inode_dec_ref_all+0xd04/0xfa0 fs/ext4/xattr.c:1134
Read of size 4 at addr ffff888120d450b0 by task syz-executor600/288

CPU: 1 PID: 288 Comm: syz-executor600 Not tainted 5.10.234-syzkaller-00033-g094fc3778d6b #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:452
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
 ext4_xattr_inode_dec_ref_all+0xd04/0xfa0 fs/ext4/xattr.c:1134
 ext4_xattr_delete_inode+0xaa6/0xc80 fs/ext4/xattr.c:2901
 ext4_evict_inode+0x1095/0x1730 fs/ext4/inode.c:300
 evict+0x526/0x9c0 fs/inode.c:612
 iput_final fs/inode.c:1736 [inline]
 iput+0x632/0x7e0 fs/inode.c:1762
 do_unlinkat+0x48e/0x8b0 fs/namei.c:4042
 __do_sys_unlink fs/namei.c:4082 [inline]
 __se_sys_unlink fs/namei.c:4080 [inline]
 __x64_sys_unlink+0x49/0x50 fs/namei.c:4080
 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:-1
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fd44ef11a47
Code: 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 57 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:00007ffde92df868 EFLAGS: 00000206 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fd44ef11a47
RDX: 00007ffde92df890 RSI: 00007ffde92df920 RDI: 00007ffde92df920
RBP: 00007ffde92df920 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000100 R11: 0000000000000206 R12: 00007ffde92e0a10
R13: 000055555ee7b800 R14: 431bde82d7b634db R15: 00007ffde92e1aa0

The buggy address belongs to the page:
page:ffffea0004835140 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x120d45
flags: 0x4000000000000000()
raw: 4000000000000000 ffffea0004835188 ffffea0004751f88 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner info is not present (never set?)

Memory state around the buggy address:
 ffff888120d44f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888120d45000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888120d45080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                     ^
 ffff888120d45100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888120d45180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/27 11:48 android13-5.10-lts 094fc3778d6b 20510e88 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci2-android-5-10 KASAN: use-after-free Read in ext4_xattr_inode_dec_ref_all
2025/04/09 21:55 android13-5.10-lts e0b88ee5f09c 47d015b1 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-5-10 KASAN: use-after-free Read in ext4_xattr_inode_dec_ref_all
2025/04/02 12:21 android13-5.10-lts 094fc3778d6b c799dfdd .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro #1 (corrupt fs)] [mounted in repro #2 (corrupt fs)] ci2-android-5-10 KASAN: use-after-free Read in ext4_xattr_inode_dec_ref_all
* Struck through repros no longer work on HEAD.