Re: [PATCH udev] rules: set group ownership of new firewire driver device files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kay Sievers wrote:
On Thu, May 21, 2009 at 17:18, Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx> wrote:
The device capabilities are shown in child
devices of the actual devices which provide the character device files.
...
+SUBSYSTEM=="firewire", ATTR{specifier_id}=="0x00a02d", \
  ATTR{version}=="0x00010?", PROGRAM="/bin/chgrp video /dev/%P"

Oh, this breaks all sorts of valid assumptions, like it would break
rules plugging into the real device, get overwritten by a child
device. And we rely on proper permissions applied when the event is
send, and not an unpredictable amount of time later by a child device,
and so on ...

:-(

[For the following discussion: fw_device is the parent which is associated with a character device file, fw_unit are the children. In principle, fw_unit's could come and go at any point during the lifetime of an fw_device, but for simplicity's sake our implementation destroys and fw_device if a unit went away or was added on the respective FireWire node, and a new fw_device is created in its stead. This simplification in internal housekeeping should also make it simpler to come up with a fix for this uevent handling issue/ attributes availability issue here.]

Does the fw driver know at the point it creates the device with the
node, that there are childs to create? And such properties can not be
made available at the device itself? Like for USB, where we have the
raw "descriptor" attribute at the device, which allows us to see all
possible interfaces and apply an user access control list to the node
if a matching interface type is found.

With some effort, we could add some fw_device attributes which reflect fw_unit properties. We would have to encode a little bit of higher-level knowledge into the fw_device handling part; but why not if it makes life for userland considerably simpler.

Or maybe delay all uevents until the childs are all created, and send
the events only after that, so the child devices can be seen at the
time the event is sent out. We do that for disks, where all partitions
are fully created, before we send out the events: first for the disk,
and then for all partitions.

How would that be done?  Like this?

	dev_set_uevent_suppress(parent, 1);
	device_add(parent);

	for_each_unit(;;)
		device_add(child);

	dev_set_uevent_suppress(parent, 0);
	kobject_uevent(&parent->kobj, KOBJ_ADD);

And then, how would an udev rule look like to match attributes in the fw_device's subdirectories instead of direct attributes?

SUBSYSTEM=="firewire", \
	ATTR{*/specifier_id}=="0x00a02d", \
	ATTR{*/version}=="0x00010?", \
	GROUP="video"

We fixed almost all these know issues in other subsystems now and I
would really like to see that solved properly, without chrgrp hacks
like in the rules above. It would hit us back badly, when generic
infrastructure which will expect proper event timing regarding device
properties.

Hmm, or maybe we should associate character device files with the fw_units instead? Could break Fedora's userland though. Alas I don't know in detail what Fedora does to set ACLs on /dev/fw*.

And it would remove the possibility to use the firewire-cdev ABI with nodes which do not have any unit directories, but this is a rather hypothetical case since higher-level IEEE 1394 based protocols are all coupled with unit directories.
--
Stefan Richter
-=====-=-=== -=-= -==-=
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux