Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-10 Thread Tetsuo Handa
On 2021/03/10 11:07, Shuah Khan wrote: > On 3/9/21 6:02 PM, Tetsuo Handa wrote: >> On 2021/03/10 9:29, Shuah Khan wrote: 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

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-09 Thread Shuah Khan
On 3/9/21 6:02 PM, Tetsuo Handa wrote: On 2021/03/10 9:29, Shuah Khan wrote: 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

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-09 Thread Tetsuo Handa
On 2021/03/10 9:29, Shuah Khan wrote: >> 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

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-09 Thread Shuah Khan
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,

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-09 Thread Tetsuo Handa
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

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-09 Thread Shuah Khan
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.

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-09 Thread Tetsuo Handa
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

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-09 Thread Shuah Khan
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

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-09 Thread Shuah Khan
On 3/8/21 9:27 AM, Shuah Khan wrote: On 3/8/21 3:10 AM, Tetsuo Handa wrote: On 2021/03/08 16:35, Tetsuo Handa wrote: On 2021/03/08 12:53, Shuah Khan wrote: Fix the above problems: - Stop using kthread_get_run() macro to create/start threads. - Create threads and get task struct reference. -

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-09 Thread Tetsuo Handa
On 2021/03/09 20:04, 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

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-09 Thread Tetsuo Handa
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

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-08 Thread Shuah Khan
On 3/8/21 3:10 AM, Tetsuo Handa wrote: On 2021/03/08 16:35, Tetsuo Handa wrote: On 2021/03/08 12:53, Shuah Khan wrote: Fix the above problems: - Stop using kthread_get_run() macro to create/start threads. - Create threads and get task struct reference. - Add kthread_create() failure handling

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-08 Thread Tetsuo Handa
On 2021/03/08 16:35, Tetsuo Handa wrote: > On 2021/03/08 12:53, Shuah Khan wrote: >> Fix the above problems: >> - Stop using kthread_get_run() macro to create/start threads. >> - Create threads and get task struct reference. >> - Add kthread_create() failure handling and bail out. >> - Hold

Re: [PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-07 Thread Tetsuo Handa
On 2021/03/08 12:53, Shuah Khan wrote: > Fix the above problems: > - Stop using kthread_get_run() macro to create/start threads. > - Create threads and get task struct reference. > - Add kthread_create() failure handling and bail out. > - Hold usbip_device lock to update local and shared states

[PATCH 4/6] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf

2021-03-07 Thread Shuah Khan
usbip_sockfd_store() is invoked when user requests attach (import) detach (unimport) usb device from usbip host. vhci_hcd sends import request and usbip_sockfd_store() exports the device if it is free for export. Export and unexport are governed by local state and shared state - Shared state