syzbot


KASAN: out-of-bounds Read in ext4_xattr_set_entry

Status: upstream: reported C repro on 2021/04/12 14:20
Reported-by: syzbot+97177fd4bf74cef7673e@syzkaller.appspotmail.com
First crash: 593d, last: 79d

Fix bisection: failed (bisect log)
similar bugs (6):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in ext4_xattr_set_entry (2) C done 7 440d 898d 1/1 fixed on 2021/10/13 07:23
android-54 KASAN: out-of-bounds Read in ext4_xattr_set_entry C 1 615d 615d 0/2 upstream: reported C repro on 2021/03/21 22:06
android-5-10 general protection fault in ext4_xattr_set_entry (2) C error 19 12h32m 42d 0/2 upstream: reported C repro on 2022/10/15 11:08
upstream KASAN: use-after-free Read in ext4_xattr_set_entry (5) 2 124d 182d 0/24 auto-obsoleted due to no activity on 2022/11/22 17:19
upstream KASAN: use-after-free Read in ext4_xattr_set_entry (4) C error done 21 278d 665d 22/24 fixed on 2022/03/28 10:17
android-5-10 general protection fault in ext4_xattr_set_entry C error 2 65d 79d 0/2 closed as invalid on 2022/09/26 18:30

Sample crash report:
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop0): ext4_mb_generate_buddy:754: group 0, block bitmap and bg descriptor inconsistent: 50 vs 25 free clusters
==================================================================
BUG: KASAN: out-of-bounds in memmove include/linux/string.h:391 [inline]
BUG: KASAN: out-of-bounds in ext4_xattr_set_entry+0x1787/0x3180 fs/ext4/xattr.c:1732
Read of size 18446744073709551600 at addr ffff88809b8980b8 by task syz-executor772/7987

CPU: 0 PID: 7987 Comm: syz-executor772 Not tainted 4.14.230-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report+0x6f/0x80 mm/kasan/report.c:409
 memmove+0x20/0x50 mm/kasan/kasan.c:293
 memmove include/linux/string.h:391 [inline]
 ext4_xattr_set_entry+0x1787/0x3180 fs/ext4/xattr.c:1732
 ext4_xattr_ibody_inline_set+0x73/0x280 fs/ext4/xattr.c:2221
 ext4_destroy_inline_data_nolock+0x1cb/0x440 fs/ext4/inline.c:440
 ext4_convert_inline_data_nolock+0x115/0xb40 fs/ext4/inline.c:1213
 ext4_convert_inline_data+0x2ae/0x300 fs/ext4/inline.c:2001
 ext4_fallocate+0x106/0x1d80 fs/ext4/extents.c:4964
 vfs_fallocate+0x346/0x790 fs/open.c:319
 SYSC_fallocate fs/open.c:342 [inline]
 SyS_fallocate+0x4a/0x80 fs/open.c:336
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x449b69
RSP: 002b:00007f55599e22f8 EFLAGS: 00000246 ORIG_RAX: 000000000000011d
RAX: ffffffffffffffda RBX: 00000000004cb420 RCX: 0000000000449b69
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000007
RBP: 000000000049b064 R08: 0000000000000000 R09: 0000000000000000
R10: 000000000000bb89 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 000000000049a060 R14: e5d26e84aa4cf3c6 R15: 00000000004cb428

The buggy address belongs to the page:
page:ffffea00026e2600 count:2 mapcount:0 mapping:ffff8880b1e334a8 index:0x8
flags: 0xfff0000001107c(referenced|uptodate|dirty|lru|active|private|mappedtodisk)
raw: 00fff0000001107c ffff8880b1e334a8 0000000000000008 00000002ffffffff
raw: ffffea000249e4e0 ffffea00026d96e0 ffff88808e368348 ffff88823b320880
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff88823b320880

Memory state around the buggy address:
 ffff88809b897f80: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc
 ffff88809b898000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88809b898080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                        ^
 ffff88809b898100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88809b898180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2021/04/14 17:32 linux-4.14.y 958e517f4e16 3134b37f .config log report syz C KASAN: out-of-bounds Read in ext4_xattr_set_entry
ci2-linux-4-14 2021/04/12 14:20 linux-4.14.y 958e517f4e16 6a81331a .config log report syz C KASAN: out-of-bounds Read in ext4_xattr_set_entry
* Struck through repros no longer work on HEAD.