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]
Message-ID: <c49f2d6d-7974-5bc7-9bc1-ac265a23c2c0@gmail.com>
Date:   Mon, 20 Dec 2021 21:39:43 +0100
From:   Rafał Miłecki <zajec5@...il.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Jonathan Corbet <corbet@....net>,
        Daniel Vetter <daniel.vetter@...ll.ch>,
        Dan Williams <dan.j.williams@...el.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Krzysztof Wilczyński <kw@...ux.com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        Rafał Miłecki <rafal@...ecki.pl>
Subject: Re: [PATCH 2/2] nvmem: expose NVMEM cells in sysfs

Hi Greg,

On 20.12.2021 09:00, Greg Kroah-Hartman wrote:
> On Mon, Dec 20, 2021 at 07:47:30AM +0100, Rafał Miłecki wrote:
>>   static void nvmem_cell_entry_add(struct nvmem_cell_entry *cell)
>>   {
>> +	struct device *dev = &cell->nvmem->dev;
>> +	int err;
>> +
>>   	mutex_lock(&nvmem_mutex);
>>   	list_add_tail(&cell->node, &cell->nvmem->cells);
>>   	mutex_unlock(&nvmem_mutex);
>> +
>> +	sysfs_attr_init(&cell->battr.attr);
>> +	cell->battr.attr.name = cell->name;
>> +	cell->battr.attr.mode = 0400;
>> +	cell->battr.read = nvmem_cell_attr_read;
>> +	err = sysfs_add_bin_file_to_group(&dev->kobj, &cell->battr,
>> +					  nvmem_cells_group.name);
> 
> Why not just use the is_bin_visible attribute instead to determine if
> the attribute should be shown or not instead of having to add it
> after-the-fact which will race with userspace and loose?

I'm sorry I really don't see how you suggest to get it done.

I can use .is_bin_visible() callback indeed to respect nvmem->root_only.
I don't understand addig-after-the-fact part. How is .is_bin_visible()
related to adding attributes for newly created cells? Do you mean I can
avoid calling sysfs_add_bin_file_to_group()? Do you recall any existing
example of such solution?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ