syzbot


KASAN: use-after-free Write in ext4_write_inline_data

Status: upstream: reported C repro on 2021/02/04 16:01
Reported-by: syzbot+4f5051bdd848bd35a6b8@syzkaller.appspotmail.com
First crash: 1230d, last: 477d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Write in ext4_write_inline_data ext4 C done error 1 1042d 1038d 0/27 auto-obsoleted due to no activity on 2022/10/01 15:10
linux-4.19 KASAN: slab-out-of-bounds Write in ext4_write_inline_data C done 3 1016d 1222d 1/1 fixed on 2021/10/06 16:08
Fix bisection attempts (22)
Created Duration User Patch Repo Result
2023/02/27 02:19 34m bisect fix linux-4.14.y job log (0) log
2023/01/25 15:01 28m bisect fix linux-4.14.y job log (0) log
2022/11/14 10:44 24m bisect fix linux-4.14.y job log (0) log
2022/10/15 00:59 22m bisect fix linux-4.14.y job log (0) log
2022/09/14 06:12 27m bisect fix linux-4.14.y job log (0) log
2022/08/15 05:44 27m bisect fix linux-4.14.y job log (0) log
2022/07/16 04:44 22m bisect fix linux-4.14.y job log (0) log
2022/06/16 04:23 20m bisect fix linux-4.14.y job log (0) log
2022/05/17 04:01 21m bisect fix linux-4.14.y job log (0) log
2022/04/17 03:36 21m bisect fix linux-4.14.y job log (0) log
2022/03/17 00:52 23m bisect fix linux-4.14.y job log (0) log
2022/02/15 00:27 24m bisect fix linux-4.14.y job log (0) log
2022/01/16 00:02 24m bisect fix linux-4.14.y job log (0) log
2021/12/16 23:39 23m bisect fix linux-4.14.y job log (0) log
2021/11/16 23:17 21m bisect fix linux-4.14.y job log (0) log
2021/10/17 22:20 26m bisect fix linux-4.14.y job log (0) log
2021/09/17 21:54 25m bisect fix linux-4.14.y job log (0) log
2021/08/18 21:28 25m bisect fix linux-4.14.y job log (0) log
2021/07/19 21:03 24m bisect fix linux-4.14.y job log (0) log
2021/06/05 18:00 26m bisect fix linux-4.14.y job log (0) log
2021/04/05 16:22 26m bisect fix linux-4.14.y job log (0) log
2021/03/06 16:00 22m bisect fix linux-4.14.y job log (0) log

Sample crash report:
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
==================================================================
BUG: KASAN: use-after-free in memcpy include/linux/string.h:376 [inline]
BUG: KASAN: use-after-free in ext4_write_inline_data+0x2ae/0x380 fs/ext4/inline.c:251
Write of size 70 at addr ffff8880ab9bf016 by task syz-executor858/7980

CPU: 0 PID: 7980 Comm: syz-executor858 Not tainted 4.14.231-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
 memcpy+0x35/0x50 mm/kasan/kasan.c:303
 memcpy include/linux/string.h:376 [inline]
 ext4_write_inline_data+0x2ae/0x380 fs/ext4/inline.c:251
 ext4_write_inline_data_end+0x1d3/0x490 fs/ext4/inline.c:760
 ext4_write_end+0x18d/0xca0 fs/ext4/inode.c:1422
 ext4_da_write_end+0x6da/0x8e0 fs/ext4/inode.c:3177
 generic_perform_write+0x268/0x420 mm/filemap.c:3066
 __generic_file_write_iter+0x227/0x590 mm/filemap.c:3180
 ext4_file_write_iter+0x276/0xd20 fs/ext4/file.c:270
 call_write_iter include/linux/fs.h:1778 [inline]
 new_sync_write fs/read_write.c:469 [inline]
 __vfs_write+0x44c/0x630 fs/read_write.c:482
 vfs_write+0x17f/0x4d0 fs/read_write.c:544
 SYSC_write fs/read_write.c:590 [inline]
 SyS_write+0xf2/0x210 fs/read_write.c:582
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x449ce9
RSP: 002b:00007f2cf7f332f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00000000004cc4c0 RCX: 0000000000449ce9
RDX: 0000000000000082 RSI: 0000000020000180 RDI: 0000000000000007
RBP: 000000000049c064 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 000000000049b060 R14: 0000000300000002 R15: 00000000004cc4c8

Allocated by task 1:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 kmem_cache_alloc+0x124/0x3c0 mm/slab.c:3552
 getname_flags+0xc8/0x550 fs/namei.c:138
 do_sys_open+0x1ce/0x410 fs/open.c:1075
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 1:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
 putname+0xcd/0x110 fs/namei.c:259
 do_sys_open+0x203/0x410 fs/open.c:1090
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880ab9be540
 which belongs to the cache names_cache of size 4096
The buggy address is located 2774 bytes inside of
 4096-byte region [ffff8880ab9be540, ffff8880ab9bf540)
The buggy address belongs to the page:
page:ffffea0002ae6f80 count:1 mapcount:0 mapping:ffff8880ab9be540 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffff8880ab9be540 0000000000000000 0000000100000001
raw: ffffea0002b0ab20 ffffea00026e5220 ffff88823f8bb200 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880ab9bef00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880ab9bef80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880ab9bf000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff8880ab9bf080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880ab9bf100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/04/20 16:06 linux-4.14.y cf256fbcbe34 c0ced557 .config console log report syz C ci2-linux-4-14 KASAN: use-after-free Write in ext4_write_inline_data
2021/02/04 16:00 linux-4.14.y 2c8a3fceddf0 42b90a7c .config console log report syz C ci2-linux-4-14 KASAN: use-after-free Write in ext4_write_inline_data
2021/06/19 21:03 linux-4.14.y cfb41ef9deb1 aba2b2fb .config console log report syz C ci2-linux-4-14 KASAN: slab-out-of-bounds Write in ext4_write_inline_data
2021/05/06 15:52 linux-4.14.y 7d7d1c0ab3eb 06585184 .config console log report info ci2-linux-4-14 KASAN: use-after-free Write in ext4_write_inline_data
2021/05/05 21:55 linux-4.14.y 7d7d1c0ab3eb 06c27ff5 .config console log report info ci2-linux-4-14 KASAN: use-after-free Write in ext4_write_inline_data
2021/05/06 18:00 linux-4.14.y 7d7d1c0ab3eb 06585184 .config console log report info ci2-linux-4-14 KASAN: slab-out-of-bounds Write in ext4_write_inline_data
* Struck through repros no longer work on HEAD.