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: <675979e5.5d0a0220.207826.2bf1@mx.google.com>
Date: Wed, 11 Dec 2024 12:39:13 +0100
From: Christian Marangi <ansuelsmth@...il.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: "David S. Miller" <davem@...emloft.net>, Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Antoine Tenart <atenart@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
	Waiman Long <longman@...hat.com>, Boqun Feng <boqun.feng@...il.com>,
	Nathan Chancellor <nathan@...nel.org>,
	Nick Desaulniers <ndesaulniers@...gle.com>,
	Bill Wendling <morbo@...gle.com>,
	Justin Stitt <justinstitt@...gle.com>, linux-crypto@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	llvm@...ts.linux.dev, upstream@...oha.com,
	Richard van Schagen <vschagen@...oud.com>
Subject: Re: [PATCH v8 3/3] crypto: Add Inside Secure SafeXcel EIP-93 crypto
 engine support

On Wed, Dec 11, 2024 at 05:30:56PM +0800, Herbert Xu wrote:
> On Tue, Dec 10, 2024 at 09:48:33PM +0100, Christian Marangi wrote:
> >
> > +	/*
> > +	 * Consume remaining data.
> > +	 * 1. Loop until we consume all the data in block of 64bytes
> > +	 * 2. Send full block of 64bytes
> > +	 * 3. Skip sending last block for future update() or for final() to
> > +	 *    enable HASH_FINALIZE bit.
> > +	 */
> > +	while (to_consume > 0) {
> > +		int to_read = min(to_consume, SHA256_BLOCK_SIZE);
> > +
> > +		block = kzalloc(sizeof(*block), GFP_KERNEL);
> 
> You should avoid allocating memory.  If you really must do it,
> then it needs to be GFP_ATOMIC, and your algorithm needs to set
> CRYPTO_ALG_ALLOCATES_MEMORY which means that it won't be used
> by the storage layer as memory allocations may lead to dead-lock.
>

It's problematic for the ring consumption logic to free the block as
they get consumed hence memory allocation is needed.

> The preferred way to access extra memory is through the request
> context structure.
>

Do you have quick example for this?

-- 
	Ansuel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ