lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fbf64c33-87c3-137c-4faf-66de651243fc@linuxfoundation.org>
Date:   Wed, 17 Mar 2021 09:06:47 -0600
From:   Shuah Khan <skhan@...uxfoundation.org>
To:     Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>, shuah@...nel.org
Cc:     valentina.manea.m@...il.com, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org, Greg KH <gregkh@...uxfoundation.org>,
        Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH 0/6] usbip fixes to crashes found by syzbot

On 3/17/21 12:21 AM, Tetsuo Handa wrote:
> Shuah, this driver is getting more and more cryptic and buggy.
> Please explain the strategy for serialization before you write patches.
> 
>> - Fix attach_store() to check usbip_event_happened() before
>>    waking up threads.
> 
> No, this helps nothing.
> 
>> diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c
>> index c4b4256e5dad3..f0a770adebd97 100644
>> --- a/drivers/usb/usbip/vhci_sysfs.c
>> +++ b/drivers/usb/usbip/vhci_sysfs.c
>> @@ -418,6 +418,15 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr,
>>   	spin_unlock_irqrestore(&vhci->lock, flags);
>>   	/* end the lock */
>>   
>> +	if (usbip_event_happened(&vdev->ud)) {
>> +		/*
>> +		 * something went wrong - event handler shutting
>> +		 * the connection and doing reset - bail out
>> +		 */
>> +		dev_err(dev, "Event happended - handler is active\n");
>> +		return -EAGAIN;
>> +	}
>> +
> 
> detach_store() can queue shutdown event as soon as reaching "/* end the lock */" line
> but attach_store() might be preempted immediately after verifying that
> usbip_event_happened() was false (i.e. at this location) in order to wait for
> shutdown event posted by detach_store() to be processed.
> 

Yes. I haven't sent the patch for that reason. I am trying to test a
solution. I haven't come up with a solution yet.

Holding event_lock isn't the right solution. I am not going to accept
that. This is a window that gets triggered by syzbot injecting errors
in a sequence. Fixing this should be done taking other moving parts of
the driver into account.

thanks,
-- Shuah

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ