lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK5ve-LbNeJngQPE=893-ChJXEWJHg9km1Ev6GZYx4=Zrrxg9g@mail.gmail.com>
Date:	Thu, 26 Jul 2012 13:03:11 +0800
From:	Bryan Wu <bryan.wu@...onical.com>
To:	Greg KH <gregkh@...uxfoundation.org>
Cc:	Colin Cross <ccross@...roid.com>, linux-kernel@...r.kernel.org,
	Henrique de Moraes Holschuh <hmh@....eng.br>,
	Richard Purdie <rpurdie@...ys.net>, linux-leds@...r.kernel.org
Subject: Re: [PATCH] leds: triggers: send uevent when changing triggers

On Thu, Jul 26, 2012 at 11:59 AM, Greg KH <gregkh@...uxfoundation.org> wrote:
> On Thu, Jul 26, 2012 at 11:29:48AM +0800, Bryan Wu wrote:
>> On Thu, Jul 26, 2012 at 2:54 AM, Colin Cross <ccross@...roid.com> wrote:
>> > On Tue, Jul 24, 2012 at 11:11 PM, Bryan Wu <bryan.wu@...onical.com> wrote:
>> >> On Wed, Jul 25, 2012 at 8:32 AM, Colin Cross <ccross@...roid.com> wrote:
>> >>> Some triggers create sysfs files when they are enabled.  Send a uevent
>> >>> "change" notification whenever the trigger is changed to allow userspace
>> >>> processes such as udev to modify permissions on the new files.
>> >>>
>> >>
>> >> This looks like an workaround only for led trigger, can we fix this in
>> >> sysfs level?
>> >
>> > See the previous discussion here: https://lkml.org/lkml/2012/7/20/458
>>
>> Thanks, I went through this thread here. Actually it was archived in
>> my email account, so I missed that during a trip.
>>
>> Basically, I think this issue is a kind of general issue related to
>> sysfs, not just only for led trigger system. And adding this uevent
>> notification to a upper level LED driver is not good to me, if we got
>> similar issue in other subsystem, we should add similar fix there. Why
>> not we add this in sysfs when we call device_create_file(). And this
>> will be benefit for other drivers.
>>
>> Please point out me why we can't do that in sysfs level. Thanks.
>
> Please point out to me how you _can_ do this at a sysfs level :)
>
> greg k-h

Just one quick patch for my idea: emitting a uevent in sysfs_create_file().

--
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 00012e3..04da869 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -570,10 +570,14 @@ int sysfs_add_file(struct sysfs_dirent *dir_sd,
const struct attribute *attr,

 int sysfs_create_file(struct kobject * kobj, const struct attribute * attr)
 {
+       int err = 0;
+
        BUG_ON(!kobj || !kobj->sd || !attr);

-       return sysfs_add_file(kobj->sd, attr, SYSFS_KOBJ_ATTR);
+       err = sysfs_add_file(kobj->sd, attr, SYSFS_KOBJ_ATTR);
+       kobject_uevent(kobj, KOBJ_CHANGE);

+       return err;
 }

 int sysfs_create_files(struct kobject *kobj, const struct attribute **ptr)
--


-- 
Bryan Wu <bryan.wu@...onical.com>
Kernel Developer    +86.186-168-78255 Mobile
Canonical Ltd.      www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ