Re: [PATCH] char: misc: make misc_open() and misc_register() killable

From: Tetsuo Handa
Date: Tue Jul 05 2022 - 10:35:57 EST


On 2022/07/05 23:16, Greg KH wrote:
>> Apart from whether we should fuzz snapshot code or not,
>> there seems to be a bug that causes wait_for_device_probe() to hung.
>
> What else is going on in the system at this point in time? Are devices
> still being added as part of boot init sequences? Or has boot finished
> properly and these are devices being removed?

Whatever is going on. syzkaller starts after boot has finished properly.

syzkaller is opening /dev/snapshot as one of testcases among with
connecting to usb devices using /dev/raw-gadget .

An example C reproducer is
https://syzkaller.appspot.com/text?tag=ReproC&x=13ef54d2b00000 .

Console output is
https://syzkaller.appspot.com/x/log.txt?x=11589950080000 .

>
> Some device is being probed at the moment, maybe we have a deadlock
> somewhere here...

Lockdep says __device_attach() from hub_event() was in progress.

----------------------------------------
[ 237.376478][ T28] 5 locks held by kworker/1:1/26:
[ 237.381526][ T28] #0: ffff888016b92538 ((wq_completion)usb_hub_wq){+.+.}-{0:0}, at: process_one_work+0x87a/0x1610
[ 237.392798][ T28] #1: ffffc90000c2fda8 ((work_completion)(&hub->events)){+.+.}-{0:0}, at: process_one_work+0x8ae/0x1610
[ 237.406354][ T28] #2: ffff88801f7ee220 (&dev->mutex){....}-{3:3}, at: hub_event+0x1c1/0x4680
[ 237.415920][ T28] #3: ffff88801b6c6220 (&dev->mutex){....}-{3:3}, at: __device_attach+0x7a/0x4a0
[ 237.426682][ T28] #4: ffff8880216bc1a8 (&dev->mutex){....}-{3:3}, at: __device_attach+0x7a/0x4a0
----------------------------------------