Re: KASAN: stack-out-of-bounds Write in read_extent_buffer
From: Johannes Thumshirn
Date: Mon Sep 21 2020 - 10:45:20 EST
On 21/09/2020 16:32, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 860461e4 Add linux-next specific files for 20200917
> git tree: linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=141fc5d9900000
> kernel config: https://syzkaller.appspot.com/x/.config?x=f2392812d6c63d5c
> dashboard link: https://syzkaller.appspot.com/bug?extid=1d393803acac53c985a0
> compiler: gcc (GCC) 10.1.0-syz 20200507
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16778b07900000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1216f8ad900000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+1d393803acac53c985a0@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> ==================================================================
> BUG: KASAN: stack-out-of-bounds in memcpy include/linux/string.h:399 [inline]
> BUG: KASAN: stack-out-of-bounds in read_extent_buffer+0x114/0x150 fs/btrfs/extent_io.c:5674
> Write of size 8 at addr ffffc90000dd79f0 by task kworker/u4:1/21
>
> CPU: 1 PID: 21 Comm: kworker/u4:1 Not tainted 5.9.0-rc5-next-20200917-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> Workqueue: btrfs-endio-meta btrfs_work_helper
> Call Trace:
> __dump_stack lib/dump_stack.c:77 [inline]
> dump_stack+0x198/0x1fb lib/dump_stack.c:118
> print_address_description.constprop.0.cold+0x5/0x497 mm/kasan/report.c:385
> __kasan_report mm/kasan/report.c:545 [inline]
> kasan_report.cold+0x1f/0x37 mm/kasan/report.c:562
> check_memory_region_inline mm/kasan/generic.c:186 [inline]
> check_memory_region+0x13d/0x180 mm/kasan/generic.c:192
> memcpy+0x39/0x60 mm/kasan/common.c:106
> memcpy include/linux/string.h:399 [inline]
> read_extent_buffer+0x114/0x150 fs/btrfs/extent_io.c:5674
> btree_readpage_end_io_hook+0x7de/0x950 fs/btrfs/disk-io.c:641
> end_bio_extent_readpage+0x4de/0x10c0 fs/btrfs/extent_io.c:2854
> bio_endio+0x3d3/0x7a0 block/bio.c:1449
> end_workqueue_fn+0x114/0x170 fs/btrfs/disk-io.c:1696
> btrfs_work_helper+0x20a/0xd20 fs/btrfs/async-thread.c:318
> process_one_work+0x933/0x15a0 kernel/workqueue.c:2269
> worker_thread+0x64c/0x1120 kernel/workqueue.c:2415
> kthread+0x3af/0x4a0 kernel/kthread.c:292
> ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296
>
>
> addr ffffc90000dd79f0 is located in stack of task kworker/u4:1/21 at offset 48 in frame:
> btree_readpage_end_io_hook+0x0/0x950 fs/btrfs/disk-io.c:201
>
> this frame has 4 objects:
> [48, 52) 'val'
> [64, 80) 'fsid'
> [96, 128) 'result'
> [160, 192) 'found'
>
> Memory state around the buggy address:
> ffffc90000dd7880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> ffffc90000dd7900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> ffffc90000dd7980: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 f1 f1 04 f2
> ^
> ffffc90000dd7a00: 00 00 f2 f2 00 00 00 00 f2 f2 f2 f2 00 00 00 00
> ffffc90000dd7a80: f3 f3 f3 f3 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 syzkaller@xxxxxxxxxxxxxxxx.
>
> syzbot will keep track of this issue. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> syzbot can test patches for this issue, for details see:
> https://goo.gl/tpsmEJ#testing-patches
>
#syz test: git://github.com/kdave/btrfs-devel.git misc-5.9