BPF List
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, bpf@vger.kernel.org,
	Alan Stern <stern@rowland.harvard.edu>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Peter Hutterer <peter.hutterer@who-t.net>,
	"Eric W . Biederman" <ebiederm@xmission.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>
Subject: Re: [PATCH 2/2] usb: Implement usb_revoke() BPF function
Date: Tue, 30 Aug 2022 18:28:30 +0200	[thread overview]
Message-ID: <71407e16e141ebc6e9eb042187a1448ad6cfa419.camel@hadess.net> (raw)
In-Reply-To: <Yw4ocSXDuWmlFkIg@kroah.com>

On Tue, 2022-08-30 at 17:10 +0200, Greg Kroah-Hartman wrote:
> On Tue, Aug 30, 2022 at 04:44:52PM +0200, Bastien Nocera wrote:
> > On Thu, 2022-08-18 at 17:08 +0200, Greg Kroah-Hartman wrote:
> > > On Tue, Aug 09, 2022 at 07:27:11PM +0200, Bastien Nocera wrote:
> > > > On Tue, 2022-08-09 at 18:33 +0200, Greg Kroah-Hartman wrote:
> > > > > On Tue, Aug 09, 2022 at 04:31:04PM +0200, Bastien Nocera
> > > > > wrote:
> > > > > > On Tue, 2022-08-09 at 12:38 +0200, Greg Kroah-Hartman
> > > > > > wrote:
> > > > > > > Now if you really really want to disable a device from
> > > > > > > under
> > > > > > > a
> > > > > > > user,
> > > > > > > without the file handle present, you can do that today,
> > > > > > > as
> > > > > > > root,
> > > > > > > by
> > > > > > > doing the 'unbind' hack through userspace and sysfs. 
> > > > > > > It's so
> > > > > > > common
> > > > > > > that this seems to be how virtual device managers handle
> > > > > > > virtual
> > > > > > > machines, so it should be well tested by now.
> > > > > > 
> > > > > > The only thing I know that works that way is usbip, and it
> > > > > > requires
> > > > > > unbinding each of the interfaces:
> > > > > > 
> > > > > > https://sourceforge.net/p/usbip/git-windows/ci/master/tree/trunk/userspace/src/bind-driver.c#l157
> > > > > 
> > > > > virtio devices also use the api from what I recall.
> > > > 
> > > > I can't find any code that would reference
> > > > /sys/bus/usb/drivers/usbfs/unbind or /sys/bus/usb/drivers/usbfs
> > > > wrt
> > > > virtio. Where's the host side code for that?
> > > 
> > > I mean the virtio code uses bind/unbind for it's devices, nothing
> > > to
> > > do
> > > with USB other than the userspace interface involved.
> > 
> > This is one big hammer that is really counterproductive in some
> > fairly
> > common use cases. It's fine for assigning a full USB device to a
> > VM, it
> > really isn't for gently removing "just that bit of interface" the
> > user
> > is using while leaving the rest running.
> 
> In USB, drivers are bound to interfaces, not to the device.

I did implement kernel drivers for devices all the way back in 2020, if
you remember.

> But as Alan pointed out, we don't ever really "bind" the usbfs code
> to
> the interface, so that will not work all that well :(

Right.

  reply	other threads:[~2022-08-30 16:28 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09  9:42 [PATCH 0/2] USB: core: add a way to revoke access to open USB devices Bastien Nocera
2022-08-09  9:42 ` [PATCH 1/2] " Bastien Nocera
2022-08-09 10:32   ` Greg Kroah-Hartman
2022-08-09 11:15     ` Bastien Nocera
2022-08-09 11:30       ` Greg Kroah-Hartman
2022-08-09 11:53         ` Bastien Nocera
2022-08-09 10:35   ` Greg Kroah-Hartman
2022-08-09 11:18     ` Bastien Nocera
2022-08-09 12:52       ` Greg Kroah-Hartman
2022-08-09 13:27         ` Bastien Nocera
2022-08-09 16:31           ` Greg Kroah-Hartman
2022-08-09 17:16             ` Bastien Nocera
2022-08-09 19:43           ` Alan Stern
2022-08-09 16:46   ` Eric W. Biederman
2022-08-09 17:08     ` Bastien Nocera
2022-08-10 17:18   ` kernel test robot
2022-08-10 17:28   ` kernel test robot
2022-08-09  9:43 ` [PATCH 2/2] usb: Implement usb_revoke() BPF function Bastien Nocera
2022-08-09 10:38   ` Greg Kroah-Hartman
2022-08-09 11:18     ` Bastien Nocera
2022-08-09 12:49       ` Greg Kroah-Hartman
2022-08-09 13:27         ` Bastien Nocera
2022-08-09 14:31     ` Bastien Nocera
2022-08-09 16:33       ` Greg Kroah-Hartman
2022-08-09 17:27         ` Bastien Nocera
2022-08-18 15:08           ` Greg Kroah-Hartman
2022-08-30 14:44             ` Bastien Nocera
2022-08-30 15:10               ` Greg Kroah-Hartman
2022-08-30 16:28                 ` Bastien Nocera [this message]
2022-08-09 17:22   ` Eric W. Biederman
2022-08-10 17:59   ` kernel test robot
2022-10-26 15:00   ` Bastien Nocera
2022-10-26 15:22     ` Greg Kroah-Hartman
2022-08-09 10:31 ` [PATCH 0/2] USB: core: add a way to revoke access to open USB devices Greg Kroah-Hartman
2022-08-09 11:15   ` Bastien Nocera
2022-08-09 11:29     ` Greg Kroah-Hartman
2022-08-09 17:25 ` Eric W. Biederman

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=71407e16e141ebc6e9eb042187a1448ad6cfa419.camel@hadess.net \
    --to=hadess@hadess.net \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=benjamin.tissoires@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.hutterer@who-t.net \
    --cc=stern@rowland.harvard.edu \
    /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