Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1337622

Re: [PATCH v4] usb: devio: Add ioctl to disallow detaching kernel USB drivers.

From Alan Stern <stern@rowland.harvard.edu>
Newsgroups linux.kernel
Subject Re: [PATCH v4] usb: devio: Add ioctl to disallow detaching kernel USB drivers.
Date 2016-02-18 19:50 +0100
Message-ID <r3BOj-1ky-27@gated-at.bofh.it> (permalink)
References <r2gsx-2w1-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, 14 Feb 2016, Emilio López wrote:

> From: Reilly Grant <reillyg@chromium.org>
> 
> The new USBDEVFS_DROP_PRIVILEGES ioctl allows a process to voluntarily
> relinquish the ability to issue other ioctls that may interfere with
> other processes and drivers that have claimed an interface on the
> device.
> 
> This commit also includes a simple utility to be able to test the
> ioctl, located at Documentation/usb/usbdevfs-drop-permissions.c
> 
> Example (with qemu-kvm's input device):
> 
>     $ lsusb
>     ...
>     Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd
> 
>     $ usb-devices
>     ...
>     C:  #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
>     I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=02 Driver=usbhid
> 
>     $ sudo ./usbdevfs-drop-permissions /dev/bus/usb/001/002
>     OK: privileges dropped!
>     Available options:
>     [0] Exit now
>     [1] Reset device. Should fail if device is in use
>     [2] Claim 4 interfaces. Should succeed where not in use
>     [3] Narrow interface permission mask
>     Which option shall I run?: 1
>     ERROR: USBDEVFS_RESET failed! (1 - Operation not permitted)
>     Which test shall I run next?: 2
>     ERROR claiming if 0 (1 - Operation not permitted)
>     ERROR claiming if 1 (1 - Operation not permitted)
>     ERROR claiming if 2 (1 - Operation not permitted)
>     ERROR claiming if 3 (1 - Operation not permitted)
>     Which test shall I run next?: 0
> 
> After unbinding usbhid:
> 
>     $ usb-devices
>     ...
>     I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=02 Driver=(none)
> 
>     $ sudo ./usbdevfs-drop-permissions /dev/bus/usb/001/002
>     ...
>     Which option shall I run?: 2
>     OK: claimed if 0
>     ERROR claiming if 1 (1 - Operation not permitted)
>     ERROR claiming if 2 (1 - Operation not permitted)
>     ERROR claiming if 3 (1 - Operation not permitted)
>     Which test shall I run next?: 1
>     OK: USBDEVFS_RESET succeeded
>     Which test shall I run next?: 0
> 
> After unbinding usbhid and restricting the mask:
> 
>     $ sudo ./usbdevfs-drop-permissions /dev/bus/usb/001/002
>     ...
>     Which option shall I run?: 3
>     Insert new mask: 0
>     OK: privileges dropped!
>     Which test shall I run next?: 2
>     ERROR claiming if 0 (1 - Operation not permitted)
>     ERROR claiming if 1 (1 - Operation not permitted)
>     ERROR claiming if 2 (1 - Operation not permitted)
>     ERROR claiming if 3 (1 - Operation not permitted)
> 
> Signed-off-by: Reilly Grant <reillyg@chromium.org>
> Signed-off-by: Emilio López <emilio.lopez@collabora.co.uk>

Acked-by: Alan Stern <stern@rowland.harvard.edu>

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v4] usb: devio: Add ioctl to disallow detaching kernel USB drivers. Emilio López <emilio.lopez@collabora.co.uk> - 2016-02-15 02:50 +0100
  Re: [PATCH v4] usb: devio: Add ioctl to disallow detaching kernel  USB drivers. Alan Stern <stern@rowland.harvard.edu> - 2016-02-18 19:50 +0100

csiph-web