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: <20100512193050.GA14221@oksana.dev.rtsoft.ru>
Date:	Wed, 12 May 2010 23:30:50 +0400
From:	Anton Vorontsov <cbouatmailru@...il.com>
To:	Kay Sievers <kay.sievers@...y.org>
Cc:	Greg KH <gregkh@...e.de>, Daniel Mack <daniel@...aq.de>,
	linux-kernel@...r.kernel.org,
	David Woodhouse <dwmw2@...radead.org>,
	Alexey Starikovskiy <astarikovskiy@...e.de>,
	Len Brown <len.brown@...el.com>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Matt Reimer <mreimer@...p.net>,
	Evgeniy Polyakov <zbr@...emap.net>, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH] Introduce {sysfs,device}_create_file_mode

On Wed, May 12, 2010 at 09:12:46PM +0200, Kay Sievers wrote:
> On Wed, May 12, 2010 at 21:08, Anton Vorontsov <cbouatmailru@...il.com> wrote:
> > On Wed, May 12, 2010 at 11:38:06AM -0700, Greg KH wrote:
> >> On Wed, May 12, 2010 at 10:15:46PM +0400, Anton Vorontsov wrote:
> >> > We need to create attributes with different modes across devices.
> >> > We can do this by modifying attr.mode between device_create_file
> >> > invocations, but that is racy in case of globally defined attrs.
> >> >
> >> > Luckily, there's sysfs_add_file_mode() function that seems to do
> >> > exactly what we want, and if we use it, we don't need any locks
> >> > to avoid races. Though, it isn't exposed via device-drivers core
> >> > API.
> >>
> >> But you race the creation of the device notifying userspace, and then
> >> the file being created, right?
> >
> > Yep, you've raised that question once, like 3 years ago. :-)
> >
> > http://lkml.org/lkml/2007/4/11/452
> > http://lkml.org/lkml/2007/4/12/144
> >
> > In short: we can't use attr groups since the attributes creation
> > is conditional. And we especially don't want to use the attr groups
> > for attrs with different modes. But it's not a problem, because...
> 
> Groups have a filter callback for every member, to decide if the
> attribute should be created or not.

Thanks Kay. It seems the callback was added just a few months
after the discussion above. ;-)

And this commit looks especially cool:

commit 0f4238958d28044b335644b69df6071cdb04b5ce
Author: James Bottomley <James.Bottomley@...senPartnership.com>
Date:   Thu Mar 20 20:47:52 2008 -0500

    [SCSI] sysfs: make group is_valid return a mode_t

Daniel, I think that today we can just use the attribute group
mechanism, it has all needed. Do you want me to prepare a patch
to convert existing attributes, or do you to try it yourself?

Just asking to not duplicate efforts.

-- 
Anton Vorontsov
email: cbouatmailru@...il.com
irc://irc.freenode.net/bd2
--
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