KASAN: slab-out-of-bounds Write in ext4_write_inline_data

15 views
Skip to first unread message

syzbot

unread,
Feb 12, 2021, 12:53:19 AM2/12/21
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 811218ec Linux 4.19.172
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16d707d4d00000
kernel config: https://syzkaller.appspot.com/x/.config?x=c1cb1d27398c8808
dashboard link: https://syzkaller.appspot.com/bug?extid=ee003b75a408d5f370bb
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1503d624d00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16ca0822d00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+ee003b...@syzkaller.appspotmail.com

EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy syzkaller/managers/linux-4-19/kernel/./include/linux/string.h:373 [inline]
BUG: KASAN: slab-out-of-bounds in ext4_write_inline_data+0x300/0x3d0 syzkaller/managers/linux-4-19/kernel/fs/ext4/inline.c:245
Write of size 70 at addr ffff88809888a4ef by task syz-executor460/8111

CPU: 1 PID: 8111 Comm: syz-executor460 Not tainted 4.19.172-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack syzkaller/managers/linux-4-19/kernel/lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef syzkaller/managers/linux-4-19/kernel/lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 syzkaller/managers/linux-4-19/kernel/mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 syzkaller/managers/linux-4-19/kernel/mm/kasan/report.c:354
kasan_report+0x8f/0xa0 syzkaller/managers/linux-4-19/kernel/mm/kasan/report.c:412
memcpy+0x35/0x50 syzkaller/managers/linux-4-19/kernel/mm/kasan/kasan.c:303
memcpy syzkaller/managers/linux-4-19/kernel/./include/linux/string.h:373 [inline]
ext4_write_inline_data+0x300/0x3d0 syzkaller/managers/linux-4-19/kernel/fs/ext4/inline.c:245
ext4_write_inline_data_end+0x220/0x640 syzkaller/managers/linux-4-19/kernel/fs/ext4/inline.c:754
ext4_write_end+0x1de/0xec0 syzkaller/managers/linux-4-19/kernel/fs/ext4/inode.c:1424
ext4_da_write_end+0x860/0xa70 syzkaller/managers/linux-4-19/kernel/fs/ext4/inode.c:3171
generic_perform_write+0x2ae/0x4d0 syzkaller/managers/linux-4-19/kernel/mm/filemap.c:3181
__generic_file_write_iter+0x24b/0x610 syzkaller/managers/linux-4-19/kernel/mm/filemap.c:3295
ext4_file_write_iter+0x2fe/0xf20 syzkaller/managers/linux-4-19/kernel/fs/ext4/file.c:272
call_write_iter syzkaller/managers/linux-4-19/kernel/./include/linux/fs.h:1821 [inline]
new_sync_write syzkaller/managers/linux-4-19/kernel/fs/read_write.c:474 [inline]
__vfs_write+0x51b/0x770 syzkaller/managers/linux-4-19/kernel/fs/read_write.c:487
vfs_write+0x1f3/0x540 syzkaller/managers/linux-4-19/kernel/fs/read_write.c:549
ksys_write+0x12b/0x2a0 syzkaller/managers/linux-4-19/kernel/fs/read_write.c:599
do_syscall_64+0xf9/0x620 syzkaller/managers/linux-4-19/kernel/arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x449bd9
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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fadf66392f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00000000004cc420 RCX: 0000000000449bd9
RDX: 0000000000000082 RSI: 0000000020000180 RDI: 0000000000000008
RBP: 000000000049be58 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 024645fc87234f45 R14: 26e1d8b70aefbc5b R15: 00000000004cc428

Allocated by task 1:
kmem_cache_alloc+0x122/0x370 syzkaller/managers/linux-4-19/kernel/mm/slab.c:3559
getname_flags+0xce/0x590 syzkaller/managers/linux-4-19/kernel/fs/namei.c:140
do_sys_open+0x26c/0x520 syzkaller/managers/linux-4-19/kernel/fs/open.c:1079
do_syscall_64+0xf9/0x620 syzkaller/managers/linux-4-19/kernel/arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 1:
__cache_free syzkaller/managers/linux-4-19/kernel/mm/slab.c:3503 [inline]
kmem_cache_free+0x7f/0x260 syzkaller/managers/linux-4-19/kernel/mm/slab.c:3765
putname+0xe1/0x120 syzkaller/managers/linux-4-19/kernel/fs/namei.c:261
do_sys_open+0x2ba/0x520 syzkaller/managers/linux-4-19/kernel/fs/open.c:1094
do_syscall_64+0xf9/0x620 syzkaller/managers/linux-4-19/kernel/arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809888ab80
which belongs to the cache names_cache of size 4096
The buggy address is located 1681 bytes to the left of
4096-byte region [ffff88809888ab80, ffff88809888bb80)
The buggy address belongs to the page:
page:ffffea0002622280 count:1 mapcount:0 mapping:ffff88813be83e40 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea0002622208 ffffea00027a8108 ffff88813be83e40
raw: 0000000000000000 ffff88809888ab80 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809888a380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88809888a400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88809888a480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88809888a500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88809888a580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Oct 6, 2021, 11:44:11 AM10/6/21
to syzkaller...@googlegroups.com
syzbot suspects this issue was fixed by commit:

commit c481607ba522e31e6ed01efefc19cc1d0e0a46fa
Author: Theodore Ts'o <ty...@mit.edu>
Date: Sat Aug 21 03:44:17 2021 +0000

ext4: fix race writing to an inline_data file while its xattrs are changing

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=16630a7b300000
start commit: 811218eceeaa Linux 4.19.172
git tree: linux-4.19.y
If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: ext4: fix race writing to an inline_data file while its xattrs are changing

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages