Re: KASAN: use-after-free Read in usbvision_v4l2_open

From: Andrey Konovalov
Date: Wed Dec 11 2019 - 09:23:11 EST


On Tue, Dec 10, 2019 at 9:13 PM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Tue, 10 Dec 2019, Andrey Konovalov wrote:
>
> > On Tue, Dec 10, 2019 at 8:48 PM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
>
> > > This looks like a race in v4l2_open(): The function drops the
> > > videodev_lock mutex before calling the video driver's open routine, and
> > > the device can be unregistered during the short time between.
> > >
> > > This patch tries to make the race much more likely to happen, for
> > > testing and verification.
> > >
> > > Andrey, will syzbot run the same test with this patch, even though it
> > > says it doesn't have a reproducer?
> >
> > Hi Alan,
> >
> > No, unfortunately there's nothing to run if there's no reproducer.
> > It's technically possible to run the same program log that triggered
> > the bug initially, but since the bug wasn't reproduced with this log
> > even without the patch, there isn't much sense in running it with the
> > patch applied.
>
> Actually it does make sense. That bug was caused by a race, and the
> patch tries to make the race much more likely to happen, so the same
> test should fail again.
>
> But never mind; I'll try a different approach. There's another syzbot
> bug report, one with a reproducer, and with this patch in place it
> should trigger the same race. I'll try submitting it that way.
>
> By the way, do you know why syzbot sent _two_ reply messages? One with
> message ID <00000000000031a0af05995eca0b@xxxxxxxxxx> and the other with
> message ID <000000000000441a4205995eca11@xxxxxxxxxx>? It seems like
> overkill.

Hm, I'm not sure. Dmitry?