[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMbhsRSAX3mt0nEnfOC3ydFG5WfMNihAGXDJuBWQyrS2DcKS=g@mail.gmail.com>
Date: Sat, 21 Jul 2012 09:23:58 -0700
From: Colin Cross <ccross@...roid.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: Henrique de Moraes Holschuh <hmh@....eng.br>,
Richard Purdie <richard.purdie@...uxfoundation.org>,
lkml <linux-kernel@...r.kernel.org>,
Bryan Wu <bryan.wu@...onical.com>
Subject: Re: sysfs permissions on dynamic attributes (led delay_on and delay_off)
On Sat, Jul 21, 2012 at 9:15 AM, Greg KH <gregkh@...uxfoundation.org> wrote:
> On Sat, Jul 21, 2012 at 01:08:55PM -0300, Henrique de Moraes Holschuh wrote:
>> On Sat, 21 Jul 2012, Colin Cross wrote:
>> > The delay_on and delay_off files could easily override the values from
>> > the trigger.
>> >
>> > Sending a KOBJ_CHANGE uevent is not a great solution, it's still
>> > horribly racy in userspace. This script would never work reliably:
>> > echo timer > trigger
>> > echo 1000 > delay_on
>> > echo 1000 > delay_off
>> > echo 255 > brightness
>>
>> Yes, and the proper fix is to instead use a fully async userspace based on
>> uevent callbacks. Nasty as all hell. Or the quick fix, which is to wait
>> for the system to settle after every sysfs operation that could create new
>> sysfs nodes.
>>
>> You could make sure that (1) no sysfs operation will return control to
>> userspace until it is complete, so you'd have all new sysfs nodes available
>> at the time the first echo returns [I believe it already works like that],
>
> Yes it does, what's the problem here?
>
>> and (2) either enhance sysfs to create nodes with the desired ownership and
>> permissions
>
> From the kernel, you can also do this today, if you know it's "safe" for
> users to read/write them.
You can set the permissions, but I don't know of any way to set the
owner. For my case, I need them to be writable by the "system" user
but not by all users.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists