[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190726123428.GA8381@gondor.apana.org.au>
Date: Fri, 26 Jul 2019 22:34:28 +1000
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Arnd Bergmann <arnd@...db.de>
Cc: thomas.lendacky@....com, gary.hook@....com, davem@...emloft.net,
arnd@...db.de, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com
Subject: Re: [PATCH] crypto: ccp - Reduce maximum stack usage
Arnd Bergmann <arnd@...db.de> wrote:
> Each of the operations in ccp_run_cmd() needs several hundred
> bytes of kernel stack. Depending on the inlining, these may
> need separate stack slots that add up to more than the warning
> limit, as shown in this clang based build:
>
> drivers/crypto/ccp/ccp-ops.c:871:12: error: stack frame size of 1164 bytes in function 'ccp_run_aes_cmd' [-Werror,-Wframe-larger-than=]
> static int ccp_run_aes_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
>
> The problem may also happen when there is no warning, e.g. in the
> ccp_run_cmd()->ccp_run_aes_cmd()->ccp_run_aes_gcm_cmd() call chain with
> over 2000 bytes.
>
> Mark each individual function as 'noinline_for_stack' to prevent
> this from happening, and move the calls to the two special cases for aes
> into the top-level function. This will keep the actual combined stack
> usage to the mimimum: 828 bytes for ccp_run_aes_gcm_cmd() and
> at most 524 bytes for each of the other cases.
>
> Fixes: 63b945091a07 ("crypto: ccp - CCP device driver and interface support")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> drivers/crypto/ccp/ccp-ops.c | 52 +++++++++++++++++++++---------------
> 1 file changed, 31 insertions(+), 21 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