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: <20240219115358.xui5fpoisvsubdyb@pengutronix.de>
Date: Mon, 19 Feb 2024 12:53:58 +0100
From: Marco Felsch <m.felsch@...gutronix.de>
To: Miquel Raynal <miquel.raynal@...tlin.com>
Cc: Michael Walle <michael@...le.cc>, srinivas.kandagatla@...aro.org,
	gregkh@...uxfoundation.org, rafal@...ecki.pl,
	linux-kernel@...r.kernel.org, kernel@...gutronix.de
Subject: Re: [RFC PATCH] nvmem: core: add sysfs cell write support

On 24-02-19, Miquel Raynal wrote:
> Hi Marco,
> 
> m.felsch@...gutronix.de wrote on Fri, 16 Feb 2024 11:07:50 +0100:
> 
> > Hi Michael,
> > 
> > On 24-02-16, Michael Walle wrote:
> > > Hi,
> > > 
> > > On Thu Feb 15, 2024 at 10:14 PM CET, Marco Felsch wrote:  
> > > > @@ -432,6 +466,7 @@ static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem)
> > > >  	struct bin_attribute **cells_attrs, *attrs;
> > > >  	struct nvmem_cell_entry *entry;
> > > >  	unsigned int ncells = 0, i = 0;
> > > > +	umode_t mode;
> > > >  	int ret = 0;
> > > >  
> > > >  	mutex_lock(&nvmem_mutex);
> > > > @@ -456,15 +491,18 @@ static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem)
> > > >  		goto unlock_mutex;
> > > >  	}
> > > >  
> > > > +	mode = nvmem_bin_attr_get_umode(nvmem);
> > > > +
> > > >  	/* Initialize each attribute to take the name and size of the cell */
> > > >  	list_for_each_entry(entry, &nvmem->cells, node) {
> > > >  		sysfs_bin_attr_init(&attrs[i]);
> > > >  		attrs[i].attr.name = devm_kasprintf(&nvmem->dev, GFP_KERNEL,
> > > >  						    "%s@%x", entry->name,
> > > >  						    entry->offset);
> > > > -		attrs[i].attr.mode = 0444;  
> > > 
> > > cells are not writable if there is a read post process hook, see
> > > __nvmem_cell_entry_write().
> > > 
> > > if (entry->read_post_processing)
> > > 	mode &= ~0222;  
> > 
> > good point, thanks for the hint :) I will add this and send a non-rfc
> > version if write-support is something you would like to have.
> 
> I like the idea but, what about mtd devices (and soon maybe UBI
> devices)? This may only work on EEPROM-like devices I guess, where each
> area is fully independent and where no erasure is actually expected.

For MTD I would say that you need to ensure that you need to align the
cells correctly. The cell-write should handle the page erase/write cycle
properly. E.g. an SPI-NOR need to align the cells to erase-page size or
the nvmem-cell-write need to read-copy-update the cells if they are not
erase-paged aligned.

Regarding UBI(FS) I'm not sure if this is required at all since you have
an filesystem. IMHO nvmem-cells are very lowelevel and are not made for
filesystem backed backends.

That beeing said: I have no problem if we provide write support for
EEPROMs only and adapt it later on to cover spi-nor/nand devices as
well.

Regards,
  Marco

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ