syzbot


KASAN: use-after-free Read in ext4_xattr_set_entry (4)

Status: fixed on 2022/03/28 10:17
Reported-by: syzbot+4cb1e27475bf90a9b926@syzkaller.appspotmail.com
Fix commit: 6e47a3cc68fc ext4: get rid of super block and sbi from handle_mount_ops()
First crash: 525d, last: 135d

Cause bisection: failed (bisect log)

Fix bisection: fixed by (bisect log) :
commit 6e47a3cc68fc525428297a00524833361ebbb0e9
Author: Lukas Czerner <lczerner@redhat.com>
Date: Wed Oct 27 14:18:52 2021 +0000

  ext4: get rid of super block and sbi from handle_mount_ops()

similar bugs (14):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in ext4_xattr_set_entry (3) C error 1 130d 615d 0/1 upstream: reported C repro on 2020/10/28 15:08
android-414 KASAN: use-after-free Read in ext4_xattr_set_entry (2) 6 978d 1034d 0/1 auto-closed as invalid on 2020/02/28 13:35
linux-4.14 KASAN: use-after-free Read in ext4_xattr_set_entry (2) 1 835d 835d 0/1 auto-closed as invalid on 2020/07/21 03:20
linux-4.19 KASAN: use-after-free Read in ext4_xattr_set_entry (2) C done 7 296d 754d 1/1 fixed on 2021/10/13 07:23
upstream KASAN: use-after-free Read in ext4_xattr_set_entry 1 1439d 1439d 0/22 closed as invalid on 2018/07/29 11:55
android-414 KASAN: use-after-free Read in ext4_xattr_set_entry 4 1286d 1179d 0/1 auto-closed as invalid on 2019/06/26 01:15
upstream KASAN: use-after-free Read in ext4_xattr_set_entry (5) 1 43d 39d 0/22 upstream: reported on 2022/05/28 08:51
upstream KASAN: use-after-free Read in ext4_xattr_set_entry (3) 4 731d 849d 0/22 auto-closed as invalid on 2020/11/02 08:32
linux-4.19 KASAN: use-after-free Read in ext4_xattr_set_entry syz done 10 858d 1106d 1/1 fixed on 2020/03/30 09:03
upstream KASAN: use-after-free Read in ext4_xattr_set_entry (2) C done 19 932d 1341d 16/22 fixed on 2020/02/14 01:19
android-54 KASAN: use-after-free Read in ext4_xattr_set_entry 6 698d 879d 0/2 auto-closed as invalid on 2020/12/04 21:44
linux-4.14 KASAN: use-after-free Read in ext4_xattr_set_entry C done 9 886d 978d 1/1 fixed on 2020/03/01 21:06
android-54 KASAN: out-of-bounds Read in ext4_xattr_set_entry C 1 471d 471d 0/2 upstream: reported C repro on 2021/03/21 22:06
linux-4.14 KASAN: out-of-bounds Read in ext4_xattr_set_entry C 2 25d 449d 0/1 upstream: reported C repro on 2021/04/12 14:20
Patch testing requests:
Created Duration User Patch Repo Result
2021/06/30 07:46 9m wanjiabing@vivo.com linux-next report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ext4_xattr_set_entry+0x3151/0x3780 fs/ext4/xattr.c:1586
Read of size 4 at addr ffff888030c00004 by task syz-executor392/11280

CPU: 0 PID: 11280 Comm: syz-executor392 Not tainted 5.11.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x107/0x163 lib/dump_stack.c:120
 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:230
 __kasan_report mm/kasan/report.c:396 [inline]
 kasan_report.cold+0x79/0xd5 mm/kasan/report.c:413
 ext4_xattr_set_entry+0x3151/0x3780 fs/ext4/xattr.c:1586
 ext4_xattr_ibody_set+0x78/0x2b0 fs/ext4/xattr.c:2224
 ext4_xattr_set_handle+0x8f4/0x13e0 fs/ext4/xattr.c:2380
 ext4_xattr_set+0x13a/0x340 fs/ext4/xattr.c:2493
 __vfs_setxattr+0x10e/0x170 fs/xattr.c:177
 __vfs_setxattr_noperm+0x11a/0x4c0 fs/xattr.c:208
 __vfs_setxattr_locked+0x1bf/0x250 fs/xattr.c:266
 vfs_setxattr+0x135/0x320 fs/xattr.c:291
 setxattr+0x1ff/0x290 fs/xattr.c:553
 path_setxattr+0x170/0x190 fs/xattr.c:572
 __do_sys_setxattr fs/xattr.c:587 [inline]
 __se_sys_setxattr fs/xattr.c:583 [inline]
 __x64_sys_setxattr+0xc0/0x160 fs/xattr.c:583
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x445589
Code: e8 4c b3 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 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 0f 83 0b cc fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fffdf5f9b28 EFLAGS: 00000246 ORIG_RAX: 00000000000000bc
RAX: ffffffffffffffda RBX: 0000000000000016 RCX: 0000000000445589
RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000020000100
RBP: 0000000001a18c30 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000073d
R13: 00007fffdf5f9ba0 R14: 0000000000000000 R15: 0000000000000000

The buggy address belongs to the page:
page:00000000f7ed6945 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x1 pfn:0x30c00
flags: 0xfff00000000000()
raw: 00fff00000000000 ffffea0000c56508 ffffea0000c17d88 0000000000000000
raw: 0000000000000001 0000000000000001 00000000ffffff7f 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888030bfff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888030bfff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888030c00000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff888030c00080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888030c00100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (21):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-root 2021/01/26 10:55 upstream f8ad8187c3b5 52e37319 .config log report syz C KASAN: use-after-free Read in ext4_xattr_set_entry
ci-upstream-linux-next-kasan-gce-root 2021/03/25 13:43 linux-next 20f1b5f9c07c 607e3baf .config log report syz C KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2022/02/21 10:03 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 3cd800e4 .config log report info KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2022/01/20 17:43 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 b838eb76 .config log report info KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2022/01/19 13:50 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 0620189b .config log report info KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2022/01/11 04:15 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 ddb0ab8c .config log report info KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2022/01/08 03:21 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 2ca0d385 .config log report info KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2022/01/04 09:07 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 7f723fbe .config log report info KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2021/12/31 22:30 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 e1768e9c .config log report info KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2021/12/31 08:45 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 36bd2e48 .config log report info KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2021/12/26 11:57 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 e4f103c4 .config log report info KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2021/12/15 21:18 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 572bcb40 .config log report info KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2021/11/10 22:26 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 75b04091 .config log report info KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2021/10/26 19:12 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 3ef6ca4f354c d50eb50a .config log report info KASAN: use-after-free Read in ext4_xattr_set_entry
ci-qemu2-riscv64 2022/02/21 09:42 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 3cd800e4 .config log report info KASAN: slab-out-of-bounds Write in ext4_xattr_set_entry
ci-qemu2-riscv64 2022/01/28 11:55 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 495e00c5 .config log report info KASAN: slab-out-of-bounds Write in ext4_xattr_set_entry
ci-qemu2-riscv64 2021/12/17 03:48 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 44068e19 .config log report info KASAN: slab-out-of-bounds Write in ext4_xattr_set_entry
ci-qemu2-riscv64 2021/12/15 21:22 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 64a19591a293 572bcb40 .config log report info KASAN: use-after-free Write in ext4_xattr_set_entry
ci-qemu2-riscv64 2021/10/26 23:32 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 3ef6ca4f354c d50eb50a .config log report info KASAN: slab-out-of-bounds Write in ext4_xattr_set_entry
ci-qemu2-riscv64 2021/09/05 03:58 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 7d2a07b76933 d236a457 .config log report info KASAN: slab-out-of-bounds Write in ext4_xattr_set_entry
ci-qemu2-riscv64 2021/08/29 02:31 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 417166ddec02 be2c130d .config log report info KASAN: slab-out-of-bounds Write in ext4_xattr_set_entry