Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1315102
| From | Alan Stern <stern@rowland.harvard.edu> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers. |
| Date | 2016-01-22 17:20 +0100 |
| Message-ID | <qTMBj-6ri-5@gated-at.bofh.it> (permalink) |
| References | <qTxiV-3Zo-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 21 Jan 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.
>
> Signed-off-by: Reilly Grant <reillyg@chromium.org>
> Signed-off-by: Emilio López <emilio.lopez@collabora.co.uk>
> static int proc_resetdevice(struct usb_dev_state *ps)
> {
> + struct usb_host_config *actconfig = ps->dev->actconfig;
> + struct usb_interface *interface;
> + int i, number;
> +
> + /* Don't touch the device if any interfaces are claimed. It
> + * could interfere with other drivers' operations and this
> + * process has dropped its privileges to do such things.
> + */
This comment should be rephrased. It should say something like:
"Don't allow if the process has dropped its privilege to do such
things and any of the interfaces are claimed."
You also might consider allowing the reset if the interfaces are
claimed only by the current process (or more precisely, by ps).
> +static int proc_drop_privileges(struct usb_dev_state *ps, void __user *arg)
> +{
> + struct usbdevfs_drop_privs data;
> +
> + if (copy_from_user(&data, arg, sizeof(data)))
> + return -EFAULT;
> +
> + /* This is a one way operation. Once privileges were dropped,
> + * you cannot do it again (Otherwise unprivileged processes
> + * would be able to change their allowed interfaces mask)
> + */
If you're going to keep a mask of claimable interfaces then there's no
reason this has to be a one-time operation. Processes should always be
allowed to shrink the mask, just not to grow it.
Alan Stern
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v1 0/1] ioctl to disallow detaching kernel USB drivers Emilio López <emilio.lopez@collabora.co.uk> - 2016-01-19 17:50 +0100
Re: [PATCH v1 0/1] ioctl to disallow detaching kernel USB drivers Greg KH <gregkh@linuxfoundation.org> - 2016-01-19 19:10 +0100
[PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers. Emilio López <emilio.lopez@collabora.co.uk> - 2016-01-22 01:00 +0100
Re: [PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers. Bjørn Mork <bjorn@mork.no> - 2016-01-22 10:50 +0100
Re: [PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers. Emilio López <emilio.lopez@collabora.co.uk> - 2016-01-25 03:10 +0100
Re: [PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers. Bjørn Mork <bjorn@mork.no> - 2016-01-25 09:50 +0100
Re: [PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers. Alan Stern <stern@rowland.harvard.edu> - 2016-01-25 16:30 +0100
Re: [PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers. Bjørn Mork <bjorn@mork.no> - 2016-01-25 16:40 +0100
Re: [PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers. Alan Stern <stern@rowland.harvard.edu> - 2016-01-25 16:50 +0100
Re: [PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers. Alan Stern <stern@rowland.harvard.edu> - 2016-01-22 17:20 +0100
Re: [PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers. Emilio López <emilio.lopez@collabora.co.uk> - 2016-01-25 03:10 +0100
csiph-web