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

8 views
Skip to first unread message

syzbot

unread,
Dec 4, 2021, 8:05:27 PM12/4/21
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 66722c42ec91 Linux 4.14.256
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16b36791b00000
kernel config: https://syzkaller.appspot.com/x/.config?x=b8004ce84f364d9
dashboard link: https://syzkaller.appspot.com/bug?extid=eafc7bf965d768bf75ca
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)

Unfortunately, I don't have any reproducer for this issue yet.

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

==================================================================
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 ffff8880ab3ea000 by task loop3/16850

CPU: 1 PID: 16850 Comm: loop3 Not tainted 4.14.256-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+0x5dc/0xa20 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+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:ffffea0002acfa80 count:1 mapcount:0 mapping: (null) index:0x0
flags: 0xfff00000000000()
raw: 00fff00000000000 0000000000000000 0000000000000000 00000001ffffffff
raw: dead000000000100 dead000000000200 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880ab3e9f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8880ab3e9f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8880ab3ea000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff8880ab3ea080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880ab3ea100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


---
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

unread,
Mar 16, 2022, 5:47:19 AM3/16/22
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: af48f51cb593 Linux 4.14.271
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12115015700000
kernel config: https://syzkaller.appspot.com/x/.config?x=aa6c910f47752b3a
dashboard link: https://syzkaller.appspot.com/bug?extid=eafc7bf965d768bf75ca
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=114cbd29700000

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

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
==================================================================

syzbot

unread,
Sep 24, 2022, 3:50:45 PM9/24/22
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 4edbf74132a4 Linux 4.14.294
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=179c72df080000
kernel config: https://syzkaller.appspot.com/x/.config?x=94d4cf9c4e23980f
dashboard link: https://syzkaller.appspot.com/bug?extid=eafc7bf965d768bf75ca
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=124bacdf080000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=140e9e38880000

Downloadable assets:
disk image: https://storage.googleapis.com/b40da19b4827/disk-4edbf741.raw.xz
vmlinux: https://storage.googleapis.com/a36e39677c18/vmlinux-4edbf741.xz

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

==================================================================
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 ffff8880a6fc9000 by task loop1/21582

CPU: 1 PID: 21582 Comm: loop1 Not tainted 4.14.294-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
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:1784 [inline]
loop_queue_work+0x9f2/0x21e0 drivers/block/loop.c:1798
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:ffffea00029bf240 count:0 mapcount:-127 mapping: (null) index:0x0
flags: 0xfff00000000000()
raw: 00fff00000000000 0000000000000000 0000000000000000 00000000ffffff80
raw: ffffea00025c6d60 ffffea0002a819e0 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a6fc8f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880a6fc8f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880a6fc9000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff8880a6fc9080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8880a6fc9100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Reply all
Reply to author
Forward
0 new messages