Re: KASAN: slab-out-of-bounds Read in ld_usb_read

From: Johan Hovold
Date: Fri Oct 18 2019 - 10:41:16 EST


On Mon, Aug 12, 2019 at 02:22:52PM +0200, Andrey Konovalov wrote:
> On Mon, Aug 12, 2019 at 2:18 PM syzbot
> <syzbot+ba00d6a2a24df57a94ca@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > Hello,
> >
> > syzbot found the following crash on:
> >
> > HEAD commit: e96407b4 usb-fuzzer: main usb gadget fuzzer driver
> > git tree: https://github.com/google/kasan.git usb-fuzzer
> > console output: https://syzkaller.appspot.com/x/log.txt?x=162aac02600000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=cfa2c18fb6a8068e
> > dashboard link: https://syzkaller.appspot.com/bug?extid=ba00d6a2a24df57a94ca
> > compiler: gcc (GCC) 9.0.0 20181231 (experimental)
> > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1123edc2600000
> > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16079d2c600000
> >
> > IMPORTANT: if you fix the bug, please add the following tag to the commit:
> > Reported-by: syzbot+ba00d6a2a24df57a94ca@xxxxxxxxxxxxxxxxxxxxxxxxx
> >
> > ldusb 1-1:0.28: Read buffer overflow, -131386046930688 bytes dropped
> > ==================================================================
> > BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x124/0x150
> > lib/usercopy.c:27
> > Read of size 2147479552 at addr ffff8881cd580008 by task
> > syz-executor268/1890
> >
> > CPU: 0 PID: 1890 Comm: syz-executor268 Not tainted 5.3.0-rc2+ #25
> > 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+0xca/0x13e lib/dump_stack.c:113
> > print_address_description+0x6a/0x32c mm/kasan/report.c:351
> > __kasan_report.cold+0x1a/0x33 mm/kasan/report.c:482
> > kasan_report+0xe/0x12 mm/kasan/common.c:612
> > check_memory_region_inline mm/kasan/generic.c:185 [inline]
> > check_memory_region+0x128/0x190 mm/kasan/generic.c:192
> > _copy_to_user+0x124/0x150 lib/usercopy.c:27
> > copy_to_user include/linux/uaccess.h:152 [inline]
> > ld_usb_read+0x31a/0x780 drivers/usb/misc/ldusb.c:495
>
> #syz dup: KASAN: use-after-free Read in ld_usb_release

#syz dup: KASAN: slab-out-of-bounds Read in ld_usb_read (3)