Re: usbfs, claiming entire usb devices

From: Kay Sievers
Date: Sat May 09 2009 - 13:24:06 EST


On Sat, May 9, 2009 at 19:15, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote:
>> > Yes. ÂThat is, a process shouldn't be allowed to access a locked device
>> > unless that process is the lock holder.
>>
>> You think the pid or the uid would make more sense?
>
> How about neither ?
>
> The standard Unix behaviour is to open the file O_EXCL if you want
> exclusivity. Neither uid or pid are helpful or work in the many
> environments where you want security - in particular where (as is very
> common with user space driver type code) you want parts of your code
> running setuid and parts not, as two processes with different pid and uid
> values.
>
> If O_EXCL is interpeted as exclusive access (versus kernel and re-open of
> the same node) then you can implement the rest of the sematics in user
> space.

Hmm, but his is a lock for "future" device, which did not even show up
at that point the "lock" will be taken. The files would not be opened
a second time.

The lock-file and the device file are two different files, both would
be opened only by one process - and we are playing around here with
the idea how to connect these both processes.

Thanks,
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/