syzbot


KASAN: use-after-free Read in generic_perform_write (2)

Status: upstream: reported syz repro on 2021/12/05 01:05
Reported-by: syzbot+eafc7bf965d768bf75ca@syzkaller.appspotmail.com
First crash: 254d, last: 3d02h

Fix bisection: failed (bisect log)
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 11 459d 689d 0/1 auto-closed as invalid on 2021/09/11 00:48
linux-4.19 KASAN: use-after-free Read in generic_perform_write syz error 37 32d 691d 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 426d 1488d 0/23 upstream: reported C repro on 2018/07/19 18:01

Sample crash report:
ERROR: (device loop0): diRead: i_ino != di_number
ERROR: (device loop2): diRead: i_ino != di_number
ERROR: (device loop4): diRead: i_ino != di_number
==================================================================
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:454
Read of size 4096 at addr ffff888093c82000 by task loop1/10003

CPU: 1 PID: 10003 Comm: loop1 Not tainted 4.14.271-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:454
 iov_iter_copy_from_user_atomic+0x5dc/0xa20 lib/iov_iter.c:801
 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:1780 [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+0x9f2/0x21e0 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:ffffea00024f2080 count:0 mapcount:0 mapping:          (null) index:0x0
flags: 0xfff00000000000()
raw: 00fff00000000000 0000000000000000 0000000000000000 00000000ffffffff
raw: ffffea0002672960 ffffea000254fa20 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888093c81f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888093c81f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888093c82000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff888093c82080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888093c82100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (6):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2022/03/16 09:46 linux-4.14.y af48f51cb593 9e8eaa75 .config log report syz KASAN: use-after-free Read in generic_perform_write
ci2-linux-4-14 2022/08/13 07:04 linux-4.14.y b641242202ed 8dfcaa3d .config log report info KASAN: use-after-free Read in generic_perform_write
ci2-linux-4-14 2022/06/06 09:45 linux-4.14.y b8f3be299d51 c8857892 .config log report info KASAN: use-after-free Read in generic_perform_write
ci2-linux-4-14 2022/01/14 22:02 linux-4.14.y 4ba8e26127c3 53e00b45 .config log report info KASAN: use-after-free Read in generic_perform_write
ci2-linux-4-14 2022/01/14 19:49 linux-4.14.y 4ba8e26127c3 53e00b45 .config log report info KASAN: use-after-free Read in generic_perform_write
ci2-linux-4-14 2021/12/05 01:04 linux-4.14.y 66722c42ec91 a617004c .config log report info KASAN: use-after-free Read in generic_perform_write