Linux USB
 help / color / mirror / Atom feed
From: "M. Vefa Bicakci" <m.v.b@runbox.com>
To: Shuah Khan <skhan@linuxfoundation.org>,
	linux-usb@vger.kernel.org, Bastien Nocera <hadess@hadess.net>
Cc: Andrey Konovalov <andreyknvl@google.com>,
	stable@vger.kernel.org,
	Valentina Manea <valentina.manea.m@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	syzkaller@googlegroups.com
Subject: Re: [PATCH 3/3] usbip: Make the driver's match function specific
Date: Sat, 19 Sep 2020 16:54:22 +0300	[thread overview]
Message-ID: <1580e066-41e6-ec74-7427-1dd0cdabcf90@runbox.com> (raw)
In-Reply-To: <d6d43c46-3231-7e64-b708-d1fe8349e8a3@linuxfoundation.org>

On 18/09/2020 18.49, Shuah Khan wrote:
> On 9/18/20 8:31 AM, M. Vefa Bicakci wrote:
>> Hello Shuah,
>>
>> I have just cleaned up the patches and run usbip_test.sh with a kernel without
>> the patches in this series and with a kernel in this series.
>>
>> I noticed that there is a change in behaviour due to the fact that the new
>> match function (usbip_match) does not always return true. This causes the
>> stub device driver's probe() function to not get called at all, as the new
>> more selective match function will prevent the stub device driver from being
>> considered as a potential driver for the device under consideration.
>>
> 
> Yes. This is the behavior I am concerned about and hence the reason
> to use the usbip test to verify this doesn't happen.
> 
> With the patch you have the usbip match behavior becomes restrictive
> which isn't desirable.
> 
>> All of this results in the following difference in the logs of the usbip_test.sh,
>> where the expected kernel log message "usbip-host 2-6: 2-6 is not in match_busid table... skip!"
>> is not printed by a kernel that includes the patches in this series.
>>
>> --- unpatched_kernel_log.txt  2020-09-18 17:12:10.654000000 +0300
>> +++ patched_kernel_log.txt  2020-09-18 17:12:10.654000000 +0300
>> @@ -213,70 +213,69 @@
>>       |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 480M
>>   ==============================================================
>>   modprobe usbip_host - does it work?
>>   Should see -busid- is not in match_busid table... skip! dmesg
>>   ==============================================================
>> -usbip-host 2-6: 2-6 is not in match_busid table... skip!
>>   ==============================================================
>>
>> Do you find this change in behaviour unacceptable?
> 
> Yeah. This behavior isn't acceptable.
> 
> If no, I can remove this
>> test case from usbip_test.sh with the same patch. If yes, then there is a need
>> for a different solution to resolve the unexpected negative interaction between
>> Bastien's work on generic/specific USB device driver selection and usbip
>> functionality.
>>
> 
> I would recommend finding a different solution. Now that you have the
> usbip test handy, you can verify and test for regressions.
> 
> thanks,
> -- Shuah

Thanks for the feedback, Shuah. I spent some time looking at and instrumenting
the code in an attempt to find another solution, but have not found one.

If the generic/specific USB driver selection functionality that Bastien Nocera
introduced is desired to stay in the kernel, then making usbip_match more
specific appears to be the only option for usbip to be functional without
negatively affecting other device drivers.

Should Bastien's work be reverted until a solution to this issue is found?
Would you (or anyone) have any suggestions? I would be happy to work further
on resolving this issue.

I am including a summary of my findings below my signature.

Thank you,

Vefa

=== === ===

(1) If usbip_match stays as is, then the issue reported by Andrey Konovalov at

       https://lore.kernel.org/linux-usb/CAAeHK+zOrHnxjRFs=OE8T=O9208B9HP_oo8RZpyVOZ9AJ54pAA@mail.gmail.com/

     will remain unresolved and will trickle down to Linux 5.9 due to the following
     commit's interaction with the return-true usbip_match function:

       USB: Simplify USB ID table match
       https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=master&id=0ed9498f9ecfde50c93f3f3dd64b4cd5414d9944

     This commit was mis-classified as a simplification rather than a bug-fix
     and was not backported to linux-5.8.y. (I can explain my reasoning if beneficial.)
     After cherry-picking this commit onto 5.8.10, I can reproduce Andrey's issue
     with Andrey's "keyboard" program at: https://github.com/xairy/raw-gadget.git

(2) If the following patches are also included in the kernel to fix two bugs in the
     USB driver selection logic, then a return-true usbip_match function will cause
     usbip's stub driver to be selected as the more specific device driver for all
     USB devices when the usbip_host module is loaded. (This makes all USB devices
     unavailable on my system, until I unload usbip_host and reload {x,e}hci-pci
     modules.)

       usbcore/driver: Fix specific driver selection
       https://marc.info/?l=linux-usb&m=160037262607960&q=mbox

       usbcore/driver: Fix incorrect downcast
       https://lore.kernel.org/linux-usb/20200917144151.355848-2-m.v.b@runbox.com/

     I realize that this impact statement does not match my previous description at

        https://lore.kernel.org/linux-usb/363eab9a-c32a-4c60-4d6b-14ae8d873c52@runbox.com/

     which was because I had forgotten to cherry pick 0ed9498f9e ("USB: Simplify
     USB ID table match"; i.e., the commit discussed in the previous bullet point)
     onto my v5.8.10-based test kernel.

  reply	other threads:[~2020-09-19 13:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 13:33 USB driver ID matching broken Andrey Konovalov
2020-09-16 14:15 ` Greg Kroah-Hartman
2020-09-16 14:39   ` Bastien Nocera
2020-09-16 15:58     ` M. Vefa Bicakci
2020-09-17  9:59       ` [PATCH 1/2] usbcore/driver: Fix specific driver selection M. Vefa Bicakci
2020-09-17  9:59         ` [PATCH 2/2] usbip: Make the driver's match function specific M. Vefa Bicakci
2020-09-17 10:23         ` [PATCH 1/2] usbcore/driver: Fix specific driver selection Bastien Nocera
2020-09-17 10:39           ` M. Vefa Bicakci
2020-09-17 10:49             ` Bastien Nocera
2020-09-17 14:41               ` [PATCH 1/3] " M. Vefa Bicakci
2020-09-17 14:41                 ` [PATCH 2/3] usbcore/driver: Fix incorrect downcast M. Vefa Bicakci
2020-09-17 15:01                   ` Alan Stern
2020-09-18  9:26                     ` M. Vefa Bicakci
2020-09-17 14:41                 ` [PATCH 3/3] usbip: Make the driver's match function specific M. Vefa Bicakci
2020-09-17 15:21                   ` Shuah Khan
2020-09-18  9:26                     ` M. Vefa Bicakci
2020-09-18 14:31                       ` M. Vefa Bicakci
2020-09-18 15:49                         ` Shuah Khan
2020-09-19 13:54                           ` M. Vefa Bicakci [this message]
2020-09-21 17:03                             ` M. Vefa Bicakci
2020-09-18 14:31                 ` [PATCH 1/3] usbcore/driver: Fix specific driver selection M. Vefa Bicakci
2020-09-18 14:52                   ` Alan Stern
2020-09-19 13:52                     ` M. Vefa Bicakci

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1580e066-41e6-ec74-7427-1dd0cdabcf90@runbox.com \
    --to=m.v.b@runbox.com \
    --cc=andreyknvl@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hadess@hadess.net \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=syzkaller@googlegroups.com \
    --cc=valentina.manea.m@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox