Re: KASAN: use-after-free Read in device_release_driver_internal
From: Andrey Konovalov
Date: Tue Aug 13 2019 - 08:42:55 EST
On Thu, Aug 8, 2019 at 4:00 PM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, 8 Aug 2019, Andrey Konovalov wrote:
>
> > On Thu, Aug 8, 2019 at 2:44 PM Dmitry Vyukov <dvyukov@xxxxxxxxxx> wrote:
> > >
> > > On Thu, Aug 8, 2019 at 2:28 PM Andrey Konovalov <andreyknvl@xxxxxxxxxx> wrote:
> > > >
> > > > On Wed, Aug 7, 2019 at 8:31 PM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> > > > >
> > > > > On Wed, 7 Aug 2019, syzbot wrote:
> > > > >
> > > > > > Hello,
> > > > > >
> > > > > > syzbot has tested the proposed patch and the reproducer did not trigger
> > > > > > crash:
> > > > > >
> > > > > > Reported-and-tested-by:
> > > > > > syzbot+1b2449b7b5dc240d107a@xxxxxxxxxxxxxxxxxxxxxxxxx
> > > > > >
> > > > > > Tested on:
> > > > > >
> > > > > > commit: 6a3599ce usb-fuzzer: main usb gadget fuzzer driver
> > > > > > git tree: https://github.com/google/kasan.git
> > > > > > kernel config: https://syzkaller.appspot.com/x/.config?x=700ca426ab83faae
> > > > > > compiler: gcc (GCC) 9.0.0 20181231 (experimental)
> > > > > > patch: https://syzkaller.appspot.com/x/patch.diff?x=132eec8c600000
> > > > > >
> > > > > > Note: testing is done by a robot and is best-effort only.
> > > > >
> > > > > Andrey, is there any way to get the console output from this test?
> > > >
> > > > Dmitry, would it be possible to link console log for successful tests as well?
> > >
> > > Yes. Start by filing a feature request at
> > > https://github.com/google/syzkaller/issues
> >
> > Filed https://github.com/google/syzkaller/issues/1322
> >
> > Alan, for now I've applied your patch and run the reproducer manually:
> >
> > [ 90.844643][ T74] usb 1-1: new high-speed USB device number 2
> > using dummy_hcd
> > [ 91.085789][ T74] usb 1-1: Using ep0 maxpacket: 16
> > [ 91.204698][ T74] usb 1-1: config 0 has an invalid interface
> > number: 234 but max is 0
> > [ 91.209137][ T74] usb 1-1: config 0 has no interface number 0
> > [ 91.211599][ T74] usb 1-1: config 0 interface 234 altsetting 0
> > endpoint 0x8D has an inva1
> > [ 91.216162][ T74] usb 1-1: config 0 interface 234 altsetting 0
> > endpoint 0x7 has invalid 4
> > [ 91.218211][ T74] usb 1-1: config 0 interface 234 altsetting 0
> > bulk endpoint 0x7 has inv4
> > [ 91.220131][ T74] usb 1-1: config 0 interface 234 altsetting 0
> > bulk endpoint 0x8F has in0
> > [ 91.222052][ T74] usb 1-1: New USB device found, idVendor=0421,
> > idProduct=0486, bcdDevic7
> > [ 91.223851][ T74] usb 1-1: New USB device strings: Mfr=0,
> > Product=0, SerialNumber=0
> > [ 91.233180][ T74] usb 1-1: config 0 descriptor??
> > [ 91.270222][ T74] rndis_wlan 1-1:0.234: Refcount before probe: 3
> > [ 91.275464][ T74] rndis_wlan 1-1:0.234: invalid descriptor buffer length
> > [ 91.277558][ T74] usb 1-1: bad CDC descriptors
> > [ 91.279716][ T74] rndis_wlan 1-1:0.234: Refcount after probe: 3
> > [ 91.281378][ T74] rndis_host 1-1:0.234: Refcount before probe: 3
> > [ 91.283303][ T74] rndis_host 1-1:0.234: invalid descriptor buffer length
> > [ 91.284724][ T74] usb 1-1: bad CDC descriptors
> > [ 91.286004][ T74] rndis_host 1-1:0.234: Refcount after probe: 3
> > [ 91.287318][ T74] cdc_acm 1-1:0.234: Refcount before probe: 3
> > [ 91.288513][ T74] cdc_acm 1-1:0.234: invalid descriptor buffer length
> > [ 91.289835][ T74] cdc_acm 1-1:0.234: No union descriptor, testing
> > for castrated device
> > [ 91.291555][ T74] cdc_acm 1-1:0.234: Refcount after probe: 3
> > [ 91.292766][ T74] cdc_acm: probe of 1-1:0.234 failed with error -12
> > [ 92.001549][ T96] usb 1-1: USB disconnect, device number 2
>
> Ah, that looks right, thank you. The patch worked correctly -- good
> work Oliver!
Great! Just a reminder to submit the fix :)