syzbot


KASAN: use-after-free Read in generic_perform_write

Status: auto-closed as invalid on 2021/09/11 00:48
Reported-by: syzbot+977d7e392435fe49d537@syzkaller.appspotmail.com
First crash: 729d, last: 499d
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in generic_perform_write (2) C error 7 18h43m 294d 0/1 upstream: reported C repro on 2021/12/05 01:05
linux-4.19 KASAN: use-after-free Read in generic_perform_write syz error 37 72d 731d 0/1 upstream: reported syz repro on 2020/09/24 08:55
upstream KASAN: use-after-free Read in generic_perform_write C error 73 466d 1528d 0/24 upstream: reported C repro on 2018/07/19 18:01

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in memcpy include/linux/string.h:376 [inline]
BUG: KASAN: use-after-free in memcpy_from_page+0x8c/0x110 lib/iov_iter.c:453
Read of size 4096 at addr ffff888099c35000 by task loop1/19532

CPU: 1 PID: 19532 Comm: loop1 Not tainted 4.14.232-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+0x20/0x50 mm/kasan/kasan.c:302
 memcpy include/linux/string.h:376 [inline]
 memcpy_from_page+0x8c/0x110 lib/iov_iter.c:453
 iov_iter_copy_from_user_atomic+0x594/0x930 lib/iov_iter.c:799
 generic_perform_write+0x21f/0x420 mm/filemap.c:3063
 __generic_file_write_iter+0x227/0x590 mm/filemap.c:3180
 generic_file_write_iter+0x36f/0x650 mm/filemap.c:3208
 call_write_iter include/linux/fs.h:1778 [inline]
 do_iter_readv_writev+0x4cf/0x5f0 fs/read_write.c:675
 do_iter_write+0x152/0x550 fs/read_write.c:954
 vfs_iter_write+0x70/0xa0 fs/read_write.c:967
 lo_write_bvec+0x114/0x310 drivers/block/loop.c:272
 lo_write_simple drivers/block/loop.c:294 [inline]
 do_req_filebacked drivers/block/loop.c:587 [inline]
 loop_handle_cmd drivers/block/loop.c:1779 [inline]
 loop_queue_work+0x922/0x1e80 drivers/block/loop.c:1793
 kthread_worker_fn+0x271/0x6c0 kernel/kthread.c:667
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the page:
page:ffffea0002670d40 count:0 mapcount:0 mapping:          (null) index:0x0
flags: 0xfff00000000000()
raw: 00fff00000000000 0000000000000000 0000000000000000 00000000ffffffff
raw: ffffea000271b3a0 ffffea0002654660 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888099c34f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888099c34f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888099c35000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff888099c35080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888099c35100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (11):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2021/05/14 00:47 linux-4.14.y 7d7d1c0ab3eb ecb594cb .config log report info KASAN: use-after-free Read in generic_perform_write
ci2-linux-4-14 2021/03/28 00:32 linux-4.14.y 670d6552eda8 a8529b82 .config log report info KASAN: use-after-free Read in generic_perform_write
ci2-linux-4-14 2021/03/10 20:34 linux-4.14.y 1d177c0872ab 764067f3 .config log report info KASAN: use-after-free Read in generic_perform_write
ci2-linux-4-14 2021/02/09 14:58 linux-4.14.y 2c8a3fceddf0 2bd9619f .config log report info KASAN: use-after-free Read in generic_perform_write
ci2-linux-4-14 2021/01/23 04:51 linux-4.14.y 2762b48e9611 52e37319 .config log report info KASAN: use-after-free Read in generic_perform_write
ci2-linux-4-14 2021/02/20 14:00 linux-4.14.y 29c52025152b 3e5ed8b4 .config log report info KASAN: out-of-bounds Read in generic_perform_write
ci2-linux-4-14 2020/11/28 11:24 linux-4.14.y 87335852c5d9 486f93ef .config log report info
ci2-linux-4-14 2020/11/15 09:22 linux-4.14.y 27ce4f2a6817 1bf9a662 .config log report info
ci2-linux-4-14 2020/11/04 19:10 linux-4.14.y 2b7915014161 cba33199 .config log report info
ci2-linux-4-14 2020/10/20 20:13 linux-4.14.y cbfa1702aaf6 ff4a3345 .config log report info
ci2-linux-4-14 2020/09/26 09:39 linux-4.14.y cbfa1702aaf6 4a006f63 .config log report info
* Struck through repros no longer work on HEAD.