KASAN: use-after-free Read in generic_perform_write

16 views
Skip to first unread message

syzbot

unread,
Sep 24, 2020, 4:55:17 AM9/24/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d09b8017 Linux 4.19.147
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10c704e3900000
kernel config: https://syzkaller.appspot.com/x/.config?x=47cc70be3c316a0a
dashboard link: https://syzkaller.appspot.com/bug?extid=ab73f0a75a218956b10e
compiler: gcc (GCC) 10.1.0-syz 20200507

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+ab73f0...@syzkaller.appspotmail.com

IPv6: ADDRCONF(NETDEV_UP): vlan21: link is not ready
ERROR: (device loop5): diRead: i_ino != di_number
UDF-fs: INFO Mounting volume 'LinuxUDF', timestamp 2020/09/19 18:44 (1000)
==================================================================
BUG: KASAN: use-after-free in memcpy include/linux/string.h:373 [inline]
BUG: KASAN: use-after-free in memcpy_from_page+0x8c/0x120 lib/iov_iter.c:453
Read of size 4096 at addr ffff88808d0a9000 by task loop5/15887

CPU: 1 PID: 15887 Comm: loop5 Not tainted 4.19.147-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x22c/0x33e lib/dump_stack.c:118
print_address_description.cold+0x56/0x25c mm/kasan/report.c:256
kasan_report_error.cold+0x66/0xb9 mm/kasan/report.c:354
kasan_report+0x8f/0x96 mm/kasan/report.c:412
memcpy+0x20/0x50 mm/kasan/kasan.c:302
memcpy include/linux/string.h:373 [inline]
memcpy_from_page+0x8c/0x120 lib/iov_iter.c:453
iov_iter_copy_from_user_atomic+0x72e/0xac0 lib/iov_iter.c:929
generic_perform_write+0x265/0x4d0 mm/filemap.c:3170
__generic_file_write_iter+0x24b/0x610 mm/filemap.c:3287
generic_file_write_iter+0x3f8/0x729 mm/filemap.c:3315
call_write_iter include/linux/fs.h:1821 [inline]
do_iter_readv_writev+0x668/0x7a0 fs/read_write.c:681
do_iter_write+0x182/0x5d0 fs/read_write.c:960
vfs_iter_write+0x70/0xa0 fs/read_write.c:973
lo_write_bvec+0x141/0x3e0 drivers/block/loop.c:274
lo_write_simple drivers/block/loop.c:296 [inline]
do_req_filebacked drivers/block/loop.c:619 [inline]
loop_handle_cmd drivers/block/loop.c:1926 [inline]
loop_queue_work+0xb30/0x2460 drivers/block/loop.c:1940
kthread_worker_fn+0x2a8/0x770 kernel/kthread.c:675
kthread+0x33f/0x460 kernel/kthread.c:259
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

The buggy address belongs to the page:
page:ffffea0002342a40 count:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0xfffe0000000000()
raw: 00fffe0000000000 ffffea0002320008 ffffea000230c5c8 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88808d0a8f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
ffff88808d0a8f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88808d0a9000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88808d0a9080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88808d0a9100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================


---
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,
Sep 26, 2020, 5:40:25 AM9/26/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: cbfa1702 Linux 4.14.198
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12ad47c3900000
kernel config: https://syzkaller.appspot.com/x/.config?x=3990958d85b55e59
dashboard link: https://syzkaller.appspot.com/bug?extid=977d7e392435fe49d537
compiler: gcc (GCC) 10.1.0-syz 20200507

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+977d7e...@syzkaller.appspotmail.com

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

CPU: 1 PID: 22829 Comm: loop1 Not tainted 4.14.198-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/0x283 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
kasan_report+0x6f/0x7b mm/kasan/report.c:409
memcpy+0x20/0x50 mm/kasan/kasan.c:302
memcpy include/linux/string.h:372 [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:3055
__generic_file_write_iter+0x227/0x590 mm/filemap.c:3172
generic_file_write_iter+0x36f/0x650 mm/filemap.c:3200
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:642
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:ffffea00013f0880 count:0 mapcount:0 mapping: (null) index:0x0
flags: 0xfffe0000000000()
raw: 00fffe0000000000 0000000000000000 0000000000000000 00000000ffffffff
raw: ffffea000282dba0 ffffea00013b5120 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88804fc21f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88804fc21f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88804fc22000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88804fc22080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88804fc22100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

syzbot

unread,
Sep 10, 2021, 8:48:21 PM9/10/21
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.

syzbot

unread,
Apr 17, 2022, 1:37:20 PM4/17/22
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13d2ed5cf00000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=ab73f0a75a218956b10e
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14cef67cf00000

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

ERROR: (device loop1): diRead: i_ino != di_number
ERROR: (device loop4): diRead: i_ino != di_number
ERROR: (device loop0): diRead: i_ino != di_number
==================================================================
BUG: KASAN: use-after-free in memcpy include/linux/string.h:377 [inline]
BUG: KASAN: use-after-free in memcpy_from_page+0x8c/0x120 lib/iov_iter.c:453
Read of size 4096 at addr ffff8880a89ba000 by task loop0/15081

CPU: 1 PID: 15081 Comm: loop0 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
kasan_report+0x8f/0xa0 mm/kasan/report.c:412
memcpy+0x20/0x50 mm/kasan/kasan.c:302
memcpy include/linux/string.h:377 [inline]
memcpy_from_page+0x8c/0x120 lib/iov_iter.c:453
iov_iter_copy_from_user_atomic+0x701/0xaa0 lib/iov_iter.c:929
generic_perform_write+0x265/0x4d0 mm/filemap.c:3178
__generic_file_write_iter+0x24b/0x610 mm/filemap.c:3295
generic_file_write_iter+0x3f8/0x730 mm/filemap.c:3323
call_write_iter include/linux/fs.h:1821 [inline]
do_iter_readv_writev+0x668/0x790 fs/read_write.c:681
do_iter_write+0x182/0x5d0 fs/read_write.c:960
vfs_iter_write+0x70/0xa0 fs/read_write.c:973
lo_write_bvec+0x141/0x370 drivers/block/loop.c:274
lo_write_simple drivers/block/loop.c:296 [inline]
do_req_filebacked drivers/block/loop.c:619 [inline]
loop_handle_cmd drivers/block/loop.c:1926 [inline]
loop_queue_work+0xa1c/0x20c0 drivers/block/loop.c:1940
kthread_worker_fn+0x292/0x730 kernel/kthread.c:700
kthread+0x33f/0x460 kernel/kthread.c:259
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

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

Memory state around the buggy address:
ffff8880a89b9f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880a89b9f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880a89ba000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff8880a89ba080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8880a89ba100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

syzbot

unread,
Nov 26, 2022, 9:53:37 AM11/26/22
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10cb55c5880000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=ab73f0a75a218956b10e
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1695f58d880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=150cbce3880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/98c0bdb4abb3/disk-3f8a27f9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ea228ff02669/vmlinux-3f8a27f9.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/189c8496922c/mount_0.gz

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

loop_set_block_size: loop5 () has still dirty pages (nrpages=3)
loop_set_block_size: loop5 () has still dirty pages (nrpages=2)
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:377 [inline]
BUG: KASAN: slab-out-of-bounds in memcpy_from_page+0x8c/0x120 lib/iov_iter.c:453
Read of size 2048 at addr ffff88809cd41540 by task loop5/8413

CPU: 0 PID: 8413 Comm: loop5 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
kasan_report+0x8f/0xa0 mm/kasan/report.c:412
memcpy+0x20/0x50 mm/kasan/kasan.c:302
memcpy include/linux/string.h:377 [inline]
memcpy_from_page+0x8c/0x120 lib/iov_iter.c:453
iov_iter_copy_from_user_atomic+0x701/0xaa0 lib/iov_iter.c:929
generic_perform_write+0x265/0x4d0 mm/filemap.c:3178
__generic_file_write_iter+0x24b/0x610 mm/filemap.c:3295
generic_file_write_iter+0x3f8/0x730 mm/filemap.c:3323
call_write_iter include/linux/fs.h:1821 [inline]
do_iter_readv_writev+0x668/0x790 fs/read_write.c:681
do_iter_write+0x182/0x5d0 fs/read_write.c:960
vfs_iter_write+0x70/0xa0 fs/read_write.c:973
lo_write_bvec+0x141/0x370 drivers/block/loop.c:274
lo_write_simple drivers/block/loop.c:296 [inline]
do_req_filebacked drivers/block/loop.c:619 [inline]
loop_handle_cmd drivers/block/loop.c:1926 [inline]
loop_queue_work+0xa1c/0x20c0 drivers/block/loop.c:1940
kthread_worker_fn+0x292/0x730 kernel/kthread.c:700
kthread+0x33f/0x460 kernel/kthread.c:259
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 8405:
__do_kmalloc mm/slab.c:3727 [inline]
__kmalloc+0x15a/0x3c0 mm/slab.c:3736
kmalloc include/linux/slab.h:520 [inline]
hfsplus_read_wrapper+0x2c7/0xf00 fs/hfsplus/wrapper.c:177
hfsplus_fill_super+0x30a/0x19e0 fs/hfsplus/super.c:413
mount_bdev+0x2fc/0x3b0 fs/super.c:1158
mount_fs+0xa3/0x310 fs/super.c:1261
vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
vfs_kern_mount fs/namespace.c:951 [inline]
do_new_mount fs/namespace.c:2492 [inline]
do_mount+0x115c/0x2f50 fs/namespace.c:2822
ksys_mount+0xcf/0x130 fs/namespace.c:3038
__do_sys_mount fs/namespace.c:3052 [inline]
__se_sys_mount fs/namespace.c:3049 [inline]
__x64_sys_mount+0xba/0x150 fs/namespace.c:3049
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8032:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
skb_free_head net/core/skbuff.c:563 [inline]
skb_release_data+0x6de/0x920 net/core/skbuff.c:583
skb_release_all net/core/skbuff.c:640 [inline]
__kfree_skb net/core/skbuff.c:654 [inline]
kfree_skb_partial+0x7e/0xa0 net/core/skbuff.c:4857
tcp_rcv_established+0x1b89/0x1ef0 net/ipv4/tcp_input.c:5649
tcp_v4_do_rcv+0x5d6/0x870 net/ipv4/tcp_ipv4.c:1547
tcp_v4_rcv+0x2c03/0x3b80 net/ipv4/tcp_ipv4.c:1832
ip_local_deliver_finish+0x495/0xc00 net/ipv4/ip_input.c:215
NF_HOOK include/linux/netfilter.h:289 [inline]
ip_local_deliver+0x188/0x500 net/ipv4/ip_input.c:256
dst_input include/net/dst.h:461 [inline]
ip_rcv_finish+0x1ca/0x2e0 net/ipv4/ip_input.c:414
NF_HOOK include/linux/netfilter.h:289 [inline]
ip_rcv+0xca/0x3c0 net/ipv4/ip_input.c:524
__netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:4954
__netif_receive_skb+0x27/0x1c0 net/core/dev.c:5066
netif_receive_skb_internal+0xf0/0x3f0 net/core/dev.c:5156
napi_skb_finish net/core/dev.c:5601 [inline]
napi_gro_receive+0x2e6/0x450 net/core/dev.c:5632
receive_buf+0xc2c/0x6780 drivers/net/virtio_net.c:1088
virtnet_receive drivers/net/virtio_net.c:1352 [inline]
virtnet_poll+0x568/0xe00 drivers/net/virtio_net.c:1457
napi_poll net/core/dev.c:6280 [inline]
net_rx_action+0x4ac/0xfb0 net/core/dev.c:6346
__do_softirq+0x265/0x980 kernel/softirq.c:292

The buggy address belongs to the object at ffff88809cd41540
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 0 bytes inside of
512-byte region [ffff88809cd41540, ffff88809cd41740)
The buggy address belongs to the page:
page:ffffea0002735040 count:1 mapcount:0 mapping:ffff88813bff0940 index:0xffff88809cd41a40
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002a9bb08 ffffea00026c9908 ffff88813bff0940
raw: ffff88809cd41a40 ffff88809cd41040 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809cd41600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88809cd41680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88809cd41700: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
^
ffff88809cd41780: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff88809cd41800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Reply all
Reply to author
Forward
0 new messages