From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Bastien Nocera <hadess@hadess.net>
Cc: Oliver Neukum <oneukum@suse.com>,
Peter Hutterer <peter.hutterer@who-t.net>,
linux-usb@vger.kernel.org, Alan Stern <stern@rowland.harvard.edu>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>
Subject: Re: [RFC v1] USB: core: add USBDEVFS_REVOKE ioctl
Date: Tue, 26 Apr 2022 13:10:39 +0200 [thread overview]
Message-ID: <YmfTL1gsV7lNS8iE@kroah.com> (raw)
In-Reply-To: <e43f9fe95a763efbe959084ea3f2dcd0a75f666f.camel@hadess.net>
On Tue, Apr 26, 2022 at 12:37:14PM +0200, Bastien Nocera wrote:
> On Tue, 2022-04-26 at 12:30 +0200, Greg Kroah-Hartman wrote:
> > On Tue, Apr 26, 2022 at 12:07:32PM +0200, Bastien Nocera wrote:
> > > On Tue, 2022-04-26 at 10:46 +0200, Oliver Neukum wrote:
> > > >
> > > >
> > > > On 26.04.22 09:21, Greg Kroah-Hartman wrote:
> > > > > Yes, but, it's not so simple. Many people have asked for
> > > > > revoke()
> > > > > to be
> > > > > added as a syscall like is in the BSDs, but the BSDs only allow
> > > > > that for
> > > > > a very small subset of file descriptor types, and doing it in a
> > > > > generic
> > > > > fashion seems very difficult (I tried a few years ago and gave
> > > > > up,
> > > > > but
> > > > > my knowledge of the vfs layer is minimal.)
> > > > Well, then we should go for the minimalist approach and just
> > > > add a hook to VFS. Multiple different ioctl()s are definitely a
> > > > bad
> > > > idea.
> > > > An frevoke() looks much easier to do than one based on paths.
> > > > If I understand the issue behind the proposal correctly the
> > > > caller
> > > > has opened the device.
> > >
> > > Doesn't look like FreeBSD at least has an frevoke() syscall
> > > anymore, it
> > > had an FREVOKE flag, which is now a define for the O_VERIFY option
> > > which has quite different semantics:
> > > https://www.freebsd.org/cgi/man.cgi?sektion=2&query=open
> >
> > Take a look at this implementation:
> > https://man.openbsd.org/revoke.2
> >
> I don't think anyone wants to implement path based syscalls, and again,
> it's equivalent to remote closing the fd, not to disabling the access
> to the device:
> "If the file is a special file for a device which is open, the device
> close function is called as if all open references to the file had been
> closed."
You forgot the sentence before that which is the functionality we want
here:
Subsequent operations on any such descriptors fail, with the
exceptions that a read() from a tty which has been revoked
returns a count of zero (end of file), and a close() call will
succeed.
And don't do it only for a tty device, but for any device that
implements it.
And yes, we don't want to work off of a path, but a file descriptor:
int revoke(int fd);
> If there's an implementation done at the VFS level, it should probably
> try to steer away from those earlier disparate implementations.
Agreed.
thanks,
greg k-h
next prev parent reply other threads:[~2022-04-26 11:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-25 13:23 [RFC v1] USB: core: add USBDEVFS_REVOKE ioctl Bastien Nocera
2022-04-25 13:28 ` Bastien Nocera
2022-04-25 13:49 ` Oliver Neukum
2022-04-25 14:25 ` Bastien Nocera
2022-04-25 14:45 ` Bastien Nocera
2022-04-25 14:10 ` Greg Kroah-Hartman
2022-04-25 14:28 ` Bastien Nocera
2022-04-25 15:00 ` Greg Kroah-Hartman
2022-04-25 15:17 ` Bastien Nocera
2022-04-25 15:45 ` Greg Kroah-Hartman
2022-04-26 2:27 ` Peter Hutterer
2022-04-26 7:14 ` Oliver Neukum
2022-04-26 7:21 ` Greg Kroah-Hartman
2022-04-26 8:46 ` Oliver Neukum
2022-04-26 10:07 ` Bastien Nocera
2022-04-26 10:30 ` Greg Kroah-Hartman
2022-04-26 10:37 ` Bastien Nocera
2022-04-26 11:10 ` Greg Kroah-Hartman [this message]
2022-04-28 10:28 ` Oliver Neukum
2022-04-28 11:21 ` Bastien Nocera
2022-04-26 10:07 ` Bastien Nocera
2022-04-26 10:07 ` Bastien Nocera
2022-04-25 16:14 ` Alan Stern
2022-04-25 17:09 ` Benjamin Tissoires
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=YmfTL1gsV7lNS8iE@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=benjamin.tissoires@redhat.com \
--cc=hadess@hadess.net \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
--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