[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190628041833.olvmbzj5z2hmtruq@gondor.apana.org.au>
Date: Fri, 28 Jun 2019 12:18:33 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Arnd Bergmann <arnd@...db.de>
Cc: Corentin Labbe <clabbe.montjoie@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Maxime Ripard <maxime.ripard@...tlin.com>,
Chen-Yu Tsai <wens@...e.org>,
Eric Biggers <ebiggers@...gle.com>,
linux-crypto@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: sun4i-ss - reduce stack usage
On Mon, Jun 17, 2019 at 03:25:17PM +0200, Arnd Bergmann wrote:
> After the latest addition, the stack usage of sun4i_ss_cipher_poll
> grew beyond the warning limit when KASAN is enabled:
>
> drivers/crypto/sunxi-ss/sun4i-ss-cipher.c:118:12: error: stack frame size of 1152 bytes in function 'sun4i_ss_cipher_poll' [-Werror,-Wframe-larger-than=]
> static int sun4i_ss_cipher_poll(struct skcipher_request *areq)
>
> Reduce it in three ways:
>
> - split out the new code into a separate function so its stack
> usage can overlap that of the sun4i_ss_opti_poll() code path
> - mark both special cases as noinline_for_stack, which should
> ideally result in a tail call that frees the rest of the
> stack
> - move the buf and obuf variables into the code blocks in
> which they are used.
>
> The three separate functions now use 144, 640 and 304 bytes of kernel
> stack, respectively.
>
> Fixes: 0ae1f46c55f8 ("crypto: sun4i-ss - fallback when length is not multiple of blocksize")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> drivers/crypto/sunxi-ss/sun4i-ss-cipher.c | 47 +++++++++++++++--------
> 1 file changed, 30 insertions(+), 17 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists