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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 19 Sep 2019 15:27:45 -0700
From:   mnalajal@...eaurora.org
To:     Greg KH <gregkh@...uxfoundation.org>
Cc:     Bjorn Andersson <bjorn.andersson@...aro.org>, rafael@...nel.org,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH] base: soc: Export soc_device_to_device API

On 2019-09-19 14:58, Greg KH wrote:
> On Thu, Sep 19, 2019 at 02:53:00PM -0700, Bjorn Andersson wrote:
>> On Thu 19 Sep 14:32 PDT 2019, Greg KH wrote:
>> 
>> > On Thu, Sep 19, 2019 at 02:13:44PM -0700, Murali Nalajala wrote:
>> > > If the soc drivers want to add custom sysfs entries it needs to
>> > > access "dev" field in "struct soc_device". This can be achieved
>> > > by "soc_device_to_device" API. Soc drivers which are built as a
>> > > module they need above API to be exported. Otherwise one can
>> > > observe compilation issues.
>> > >
>> > > Signed-off-by: Murali Nalajala <mnalajal@...eaurora.org>
>> > > ---
>> > >  drivers/base/soc.c | 1 +
>> > >  1 file changed, 1 insertion(+)
>> > >
>> > > diff --git a/drivers/base/soc.c b/drivers/base/soc.c
>> > > index 7c0c5ca..4ad52f6 100644
>> > > --- a/drivers/base/soc.c
>> > > +++ b/drivers/base/soc.c
>> > > @@ -41,6 +41,7 @@ struct device *soc_device_to_device(struct soc_device *soc_dev)
>> > >  {
>> > >  	return &soc_dev->dev;
>> > >  }
>> > > +EXPORT_SYMBOL_GPL(soc_device_to_device);
>> > >
>> > >  static umode_t soc_attribute_mode(struct kobject *kobj,
>> > >  				struct attribute *attr,
>> >
>> > What in-kernel driver needs this?
>> >
>> 
>> Half of the drivers interacting with the soc driver calls this API,
>> several of these I see no reason for being builtin (e.g.
>> ux500 andversatile). So I think this patch makes sense to allow us to
>> build these as modules.
>> 
>> > Is linux-next breaking without this?
>> >
>> 
>> No, we postponed the addition of any sysfs attributes in the Qualcomm
>> socinfo driver.
>> 
>> > We don't export things unless we have a user of the export.
>> >
>> > Also, adding "custom" sysfs attributes is almost always not the correct
>> > thing to do at all.  The driver should be doing it, by setting up the
>> > attribute group properly so that the driver core can do it automatically
>> > for it.
>> >
>> > No driver should be doing individual add/remove of sysfs files.  If it
>> > does so, it is almost guaranteed to be doing it incorrectly and racing
>> > userspace.
>> >
>> 
>> The problem here is that the attributes are expected to be attached to
>> the soc driver, which is separate from the platform-specific drivers. 
>> So
>> there's no way to do platform specific attributes the right way.
>> 
>> > And yes, there's loads of in-kernel examples of doing this wrong, I've
>> > been working on fixing that up, look at the patches now in Linus's tree
>> > for platform and USB drivers that do this as examples of how to do it
>> > right.
>> >
>> 
>> Agreed, this patch should not be used as an approval for any crazy
>> attributes; but it's necessary in order to extend the soc device's
>> attributes, per the current design.
> 
> Wait, no, let's not let the "current design" remain if it is broken!
> 
> Why can't the soc driver handle the attributes properly so that the
> individual driver doesn't have to do the create/remove?
> 
> thanks,
> 
> greg k-h

Current soc framework is allowing the soc info drivers to create very 
limited
soc information as sysfs entries like machine name, family, revision and 
soc_id.
Sometimes it become a limited information for the clients to know more 
about soc
information. In this scenario soc info drivers are adding their own 
sysfs entries
on top of what soc framework is doing like hw_platform, 
hw_platform_subtype etc.
I believe this will be an issue for the other soc vendors as well. It is 
good that
if we could add these into the soc framework rather than individual 
clients defining
and adding them as per their requirement.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ