mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Kernel development list <linux-kernel@vger.kernel.org>,
	Pantelis Koukousoulas <pktoss@gmail.com>,
	USB list <linux-usb@vger.kernel.org>
Subject: Re: usbfs, claiming entire usb devices
Date: Thu, 7 May 2009 23:39:53 +0200	[thread overview]
Message-ID: <ac3eb2510905071439j7736711axc729008923435cea@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0905071714220.4812-100000@iolanthe.rowland.org>

On Thu, May 7, 2009 at 23:18, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Thu, 7 May 2009, Kay Sievers wrote:
>> On Thu, May 7, 2009 at 21:55, Alan Stern <stern@rowland.harvard.edu> wrote:
>> > There is a proposal afoot to give user programs the ability to claim
>> > ownership of an entire USB device, rather than just individual
>> > interfaces.  In fact, we'd like processes to be able to own whatever
>> > device gets plugged into a particular port on a particular hub.
>> >
>> > The question is how the API should work.  A simple approach is to have
>> > a sysfs or usbfs file correspond to each port; when a process opens the
>> > file it would be granted ownership of any device plugged into that
>> > port.  Since the file is automatically closed when the process ends, we
>> > wouldn't have to worry about ownership never getting released.
>> >
>> > But there's a snag.  When a process goes to open the usbfs file for a
>> > device, the kernel needs to know whether or not the process owns that
>> > device.  In other words, we need to figure out whether or not the
>> > process has opened the corresponding port file.
>> >
>> > Is there a simple way to do this?  Is it reasonable to search through
>> > all the process's fd's, looking for one that matches a particular
>> > inode?
>> >
>> > Or would a completely different API approach be better?
>>
>> You have one file per device, and that file has normal unix file
>> permissions. Userspace can grant access to that file by ownership or
>> by adding an ACL. What else do we need?
>
> We need the ability to prevent the kernel from automatically
> configuring a device.  We need the ability to prevent kernel drivers
> from binding to a device before userspace programs get a chance.
>
>>  Why would the kernel care who
>> opened the file, when the one was able to get through the normal file
>> access check?
>
> Access checks can't be used, because programs want to stake their claim
> to the device (and its file) even before the device has been plugged
> in.  So there's no file and no ACL to set.

I see.

Can't userspace just unbind a possible driver, which is supported by
libusub? Other such use-cases do that, like the UPS userspace drivers,
which just unbind the device from a possible in-kernel driver to take
it over.

Or is that a specific requirement where things would go wrong when the
kernel binds to a device first?

Kay

  reply	other threads:[~2009-05-07 21:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1295ed070905071015n5a604f93je366faf55b695e47@mail.gmail.com>
2009-05-07 19:55 ` Alan Stern
2009-05-07 20:35   ` Kay Sievers
2009-05-07 21:18     ` Alan Stern
2009-05-07 21:39       ` Kay Sievers [this message]
2009-05-07 22:47         ` Alan Stern
2009-05-07 23:12           ` Kay Sievers
2009-05-08 14:06             ` Alan Stern
2009-05-09 17:00               ` Kay Sievers
2009-05-09 17:15                 ` Alan Cox
2009-05-09 17:23                   ` Kay Sievers

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=ac3eb2510905071439j7736711axc729008923435cea@mail.gmail.com \
    --to=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pktoss@gmail.com \
    --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

all inboxes | Powered by JetHome®