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] [day] [month] [year] [list]
Message-ID: <c8f51ece1db461a1606106ac6e8a135475914951.camel@siemens.com>
Date: Mon, 10 Nov 2025 15:09:22 +0000
From: "Sverdlin, Alexander" <alexander.sverdlin@...mens.com>
To: "christophe.leroy@...roup.eu" <christophe.leroy@...roup.eu>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
CC: "hui.wang@...onical.com" <hui.wang@...onical.com>, "mwalle@...nel.org"
	<mwalle@...nel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "florent.trinh-thai@...soprasteria.com"
	<florent.trinh-thai@...soprasteria.com>, "arnd@...db.de" <arnd@...db.de>
Subject: Re: [PATCH] eeprom: at25: convert to spi-mem API

Hi Christophe,

On Sat, 2025-11-08 at 17:24 +0100, Christophe Leroy wrote:
> > > The reason why it was not a problem before was that the transfer was
> > > done into of->prealloc_buf (fs/kernfs/file.c) which is a kmalloc() with
> > > size (PAGE_SIZE + 1).
> > > 
> > > Following the rework of at25 it now goes into the bounce buffer which is
> > > allocated with the exact size of the transfer.
> > > 
> > > Why do we need an intermediate bounce buffer now, why can't
> > > of->prealloc_buf be used directly as before ?
> > 
> > userspace access is only one part of the story, the other is NVMEM
> > kernel-internal API, like nvmem_cell_read*() and I suppose there is
> > no requirement for a destination buffer to be DMA-able.
> > 
> 
> As far as I can see nvmem_cell_read*() allocates a kmalloc() bounce 
> buffer already:

sorry, I referenced wrong family of functions, but...

> 	buf = kzalloc(max_t(size_t, entry->raw_len, entry->bytes), GFP_KERNEL);

[]

There are zero-copy call chains as well in nvmem core:

nvmem->reg_read() <= __nvmem_reg_read() <= nvmem_reg_read() <= __nvmem_cell_read() <= nvmem_device_cell_read() (exported symbol)
nvmem->reg_read() <= __nvmem_reg_read() <= nvmem_reg_read() <= nvmem_device_read() (exported)

Documentation/driver-api/nvmem.rst doesn't impose any DMA-related requirements
on a destination buffer. Seems that we are not allowed to drop the bounce buffer
in at25 driver as of now.

-- 
Alexander Sverdlin
Siemens AG
www.siemens.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ