Re: [PATCH 0/2] libudev: Get all sysfs attrs for a device

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

 



On Thu, Mar 3, 2011 at 18:00, Martin Pitt <martin.pitt@xxxxxxxxxx> wrote:
> Kay Sievers [2011-03-03 15:11 +0100]:
>> Keep in mind, that if you are root, you can do really nasty things if
>> you open/read binary files. Sysfs is not meant to be used to blindly
>> open "random" files. Think of it as device ioctl()s -- nobody would
>> expect to just issue all numbers to a device, to check what comes back
>> :) Things can go very wrong here.
>
> The current patches don't actually open the attribute files, just read
> the dir and stat the files; but I guess that was meant as a general
> "never try to iterate over all of them" warning.

Sure, it's not about the patch, it's about what this patch offers to
users, and might suggest the wrong thing to do.

>> The same code is used by udevd. For performance reasons, we can not
>> afford to call readdir() for every device we look at. We don't want to
>> cache anything which we don't need.
>
> Indeed, and I actually see no reason why
> udev_device_get_sysattr_value() would cause the building of the cache;
> shouldn't that be done in the new udev_device_get_sysattr_list_entry()
> instead, where it actually belongs?

Maybe. As said, we shoudl be careful here. Sysfs is really not meant
to be blindly iterated over. But if there is a good use case, we can
certainly do that. The "udevadm info -a" attribute stuff might even
use that.

Kay
--
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