[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1edb9542-59c9-bbf6-9f16-99614605a800@linuxfoundation.org>
Date: Tue, 9 Mar 2021 17:29:02 -0700
From: Shuah Khan <skhan@...uxfoundation.org>
To: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
shuah@...nel.org, valentina.manea.m@...il.com,
gregkh@...uxfoundation.org
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races
leading to gpf
On 3/9/21 5:03 PM, Tetsuo Handa wrote:
> On 2021/03/10 8:52, Shuah Khan wrote:
>> On 3/9/21 4:40 PM, Tetsuo Handa wrote:
>>> On 2021/03/10 4:50, Shuah Khan wrote:
>>>> On 3/9/21 4:04 AM, Tetsuo Handa wrote:
>>>>> On 2021/03/09 1:27, Shuah Khan wrote:
>>>>>> Yes. We might need synchronization between events, threads, and shutdown
>>>>>> in usbip_host side and in connection polling and threads in vhci.
>>>>>>
>>>>>> I am also looking at the shutdown sequences closely as well since the
>>>>>> local state is referenced without usbip_device lock in these paths.
>>>>>>
>>>>>> I am approaching these problems as peeling the onion an expression so
>>>>>> we can limit the changes and take a spot fix approach. We have the
>>>>>> goal to address these crashes and not introduce regressions.
>>>>>
>>>>> I think my [PATCH v4 01/12]-[PATCH v4 06/12] simplify your further changes
>>>>> without introducing regressions. While ud->lock is held when checking ud->status,
>>>>> current attach/detach code is racy about read/update of ud->status . I think we
>>>>> can close race in attach/detach code via a simple usbip_event_mutex serialization.
>>>>>
>>>>
>>>> Do you mean patches 1,2,3,3,4,5,6?
>>>
>>> Yes, my 1,2,3,4,5,6.
>>>
>>> Since you think that usbip_prepare_threads() does not worth introducing, I'm fine with
>>> replacing my 7,8,9,10,11,12 with your "[PATCH 0/6] usbip fixes to crashes found by syzbot".
>>>
>>
>> Using event lock isn't the right approach to solve the race. It is a
>> large grain lock. I am not looking to replace patches.
>
> It is not a large grain lock. Since event_handler() is exclusively executed, this lock
> does _NOT_ block event_handler() unless attach/detach operations run concurrently.
>
>>
event handler queues the events. It shouldn't be blocked by attach
and detach. The events could originate for various reasons during
the host and vhci operations. I don't like using this lock for
attach and detach.
>> I still haven't seen any response from you about if you were able to
>> verify the fixes I sent in fix the problem you are seeing.
> > I won't be able to verify your fixes, for it is syzbot who is seeing
the problem.
Thank you for letting me know.
thanks,
-- Shuah
Powered by blists - more mailing lists