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]
Date:   Sat, 25 Sep 2021 12:40:44 +0200
From:   Len Baker <len.baker@....com>
To:     Greg KH <greg@...ah.com>
Cc:     Hans de Goede <hdegoede@...hat.com>,
        Kees Cook <keescook@...omium.org>,
        Len Baker <len.baker@....com>,
        Henrique de Moraes Holschuh <hmh@....eng.br>,
        Mark Gross <mgross@...ux.intel.com>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        ibm-acpi-devel@...ts.sourceforge.net,
        platform-driver-x86@...r.kernel.org,
        linux-hardening@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] platform/x86: thinkpad_acpi: Prefer struct_size over
 open coded arithmetic

Hi,

On Tue, Sep 21, 2021 at 05:15:35PM +0200, Greg KH wrote:
>
> First off, why is a single driver doing so many odd things with
> attribute groups?  Why not just use them the way that the rest of the
> kernel does?  Why does this driver need this special handling and no one
> else does?

Is [1] the correct way to deal with devices attributes? I think so.

[1] https://www.kernel.org/doc/html/latest/driver-api/driver-model/driver.html#attributes

>
> I think the default way of handling if an attribute is enabled or not,
> should suffice here, and make things much simpler overall as all of this
> crazy attribute handling can just be removed.

Sorry but what is the default way? Would it be correct to check if the
file exists?

>
> Bonus would also be that I think it would fix the race conditions that
> happen when trying to create attributes after the device is bound to the
> driver that I think the existing driver has today.
>
> > > (I see the caller uses +2? Why? It seems to be using each of hotkey_attributes,
> > > plus 1 more attr, plus a final NULL?)
> >
> > The +2 is actually for 2 extra attributes (making the total number
> > of extra attributes +3 because the sizeof(struct attribute_set_obj)
> > already includes 1 extra).
> >
> > FWIW these 2 extra attributes are for devices with a
> > a physical rfkill on/off switch and for the device being
> > a convertible capable of reporting laptop- vs tablet-mode.
>
> Again, using the default way to show (or not show) attributes should
> solve this issue.  Why not just use that instead?

What is the default way? Would it be correct to use device_create_file()
and device_remove_file()?

Sorry if it is a trivial question but I am a kernel newbie :) I have
a lot to learn. Any suggestion or a good driver to look at would be
greatly appreciated.

Thanks,
Len

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ