Bugzilla – Bug 954324
nousb boot option has no effect (42.1 and Tumbleweed)
Last modified: 2016-01-29 13:13:36 UTC
On openSUSE 13.2 it was possible to turn of USB with the kernel boot parameter "nousb" (in GRUB). On Ubuntu 15.10 it's possible too. But on openSUSE 42.1 and current (2015-11-09) Tumbleweed USB is still working normal when "nousb" parameter is present. Can someone tell, why this doesn't works anymore? I need to turn off USB for security purposes.
How did you check that nousb doesn't take effect? Looking through the source code, indeed xhci-hcd doesn't check this option at probe unlike other host drivers, so it may be present. But USB device drivers won't load at the registration level, so it should be still effective. We should add the check in xhcd-hcd.c, too, but I wonder what any other is missing.
Tested three things: With "nousb" set (on openSUSE 13.2) lsusb aborts with error "-99" and any further output. Additionally any USB mice or keyboard is working. (the way it should be if USB is turned off) And /sys/module/kernel/parameters/nousb is Y. But on 41.2 and Tumbleweed lsusb works just normally and mices and keyboards are working normally too. Don't know why, but on 42.1 /sys/module/kernel/parameters/nousb isn't existing. Instead there's a /sys/module/usbcore/parameters/nousb which says N when "nousb" is turned on.
I see what you meant, thanks. The culprit is that the USB core is now built as a module where it was built into kernel in the earlier distro versions. You need to pass usbcore.nousb=1 instead. IMO, this is a bug in the code, though. The driver should refer to nousb no matter how it's built. Also, xhci_pci is still loaded even if usb is disabled. This is another thing to be fixed. Other host drivers refuse to load.
Looking back the git history, this change happened quite ago. commit 785895ff1fedddd09576d2c600d90404fef6506c Author: Rusty Russell <rusty@rustcorp.com.au> Date: Sat Nov 22 13:01:06 2008 +1030 USB: Don't use __module_param_call; use core_param. Impact: cleanup Found this when I changed args to __module_param_call. We now have core_param for exactly this, but Greg assures me "nousb" is used as a module parameter, so we need the #ifdef MODULE. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
(In reply to Takashi Iwai from comment #3) > I see what you meant, thanks. > > The culprit is that the USB core is now built as a module where it was built > into kernel in the earlier distro versions. You need to pass > usbcore.nousb=1 instead. > > IMO, this is a bug in the code, though. The driver should refer to nousb no > matter how it's built. It does. usbcore.nousb always should work. > Also, xhci_pci is still loaded even if usb is disabled. This is another > thing to be fixed. Other host drivers refuse to load. Yes, that is a bug.
(In reply to Oliver Neukum from comment #5) > (In reply to Takashi Iwai from comment #3) > > I see what you meant, thanks. > > > > The culprit is that the USB core is now built as a module where it was built > > into kernel in the earlier distro versions. You need to pass > > usbcore.nousb=1 instead. > > > > IMO, this is a bug in the code, though. The driver should refer to nousb no > > matter how it's built. > > It does. usbcore.nousb always should work. But "nousb" is mentioned in Documentation/kernel-parameters.txt. Either update the documentation or follow the old logic.
Thank you a lot for your help! Will you report/fix this upstream? I did some more testing: The full error message lsusb usually reports when nousb is in use on openSUSE 13.2 is: unable to initialize libusb: -99 Return code is 1 (normally 0, if USB isn't disabled). Using usbcore.nousb=1 on openSUSE 13.2 or Ubuntu 15.10 seems to have no effect. So there's probably not one way to disable USB on kernels with buildin USB and kernels with USB module, except putting both nousb and usbcore.nousb=1 in the commandline (I actually did that and it worked fine). Using usbcore.nousb=1 on openSUSE 42.1 and Tumbleweed disables USB as expected. /sys/module/usbcore/parameters/nousb is Y is usbcore.nousb=1 is in use. But lsusb behaves a little different. Is exits without any message. Nevertheless this is probably not relevant (and maybe due to the different lsusb version on 42.1/current Tumbleweed relative to 13.2) Return code of lsusb is 1 as expected.
Fix added to tree
openSUSE-SU-2016:0280-1: An update that solves 10 vulnerabilities and has 18 fixes is now available. Category: security (important) Bug References: 865096,865259,913996,950178,950998,952621,954324,954532,954647,955422,956708,957152,957988,957990,958439,958463,958504,958510,958886,958951,959190,959399,960021,960710,961263,961509,962075,962597 CVE References: CVE-2015-7550,CVE-2015-8539,CVE-2015-8543,CVE-2015-8550,CVE-2015-8551,CVE-2015-8552,CVE-2015-8569,CVE-2015-8575,CVE-2015-8767,CVE-2016-0728 Sources used: openSUSE Leap 42.1 (src): kernel-debug-4.1.15-8.1, kernel-default-4.1.15-8.1, kernel-docs-4.1.15-8.3, kernel-ec2-4.1.15-8.1, kernel-obs-build-4.1.15-8.2, kernel-obs-qa-4.1.15-8.1, kernel-obs-qa-xen-4.1.15-8.1, kernel-pae-4.1.15-8.1, kernel-pv-4.1.15-8.1, kernel-source-4.1.15-8.1, kernel-syms-4.1.15-8.1, kernel-vanilla-4.1.15-8.1, kernel-xen-4.1.15-8.1