diff mbox series

crypto: wp512: disable kmsan checks in wp512_process_buffer()

Message ID 20221215162956.4037570-1-arnd@kernel.org (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: wp512: disable kmsan checks in wp512_process_buffer() | expand

Commit Message

Arnd Bergmann Dec. 15, 2022, 4:29 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

The memory sanitizer causes excessive register spills in this function:

crypto/wp512.c:782:13: error: stack frame size (2104) exceeds limit (2048) in 'wp512_process_buffer' [-Werror,-Wframe-larger-than]

Assume that this one is safe, and mark it as needing no checks to
get the stack usage back down to the normal level.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 crypto/wp512.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Potapenko Dec. 16, 2022, 4:08 p.m. UTC | #1
> The memory sanitizer causes excessive register spills in this function:

> crypto/wp512.c:782:13: error: stack frame size (2104) exceeds limit (2048) in 'wp512_process_buffer' [-Werror,-Wframe-larger-than]

> Assume that this one is safe, and mark it as needing no checks to
> get the stack usage back down to the normal level.

KMSAN indeed bloats the stack frames heavily.
Wouldn't it be more preferable to further increase KMSAN's -Wframe-larger-than limit instead?
It is not intended for production anyway, and detecting a runtime stack overflow in the debug mode should not be a problem.
Arnd Bergmann Dec. 16, 2022, 6:29 p.m. UTC | #2
On Fri, Dec 16, 2022, at 17:08, Alexander Potapenko wrote:
>> The memory sanitizer causes excessive register spills in this function:
>
>> crypto/wp512.c:782:13: error: stack frame size (2104) exceeds limit (2048) in 'wp512_process_buffer' [-Werror,-Wframe-larger-than]
>
>> Assume that this one is safe, and mark it as needing no checks to
>> get the stack usage back down to the normal level.
>
> KMSAN indeed bloats the stack frames heavily.
> Wouldn't it be more preferable to further increase KMSAN's 
> -Wframe-larger-than limit instead?
> It is not intended for production anyway, and detecting a runtime stack 
> overflow in the debug mode should not be a problem.

I don't actually see a lot of compiler warnings with KMSAN
hitting the limit, I think we can deal with them individually.

I'd rather not raise the limit more, as that makes it harder
to identify functions that use more stack than they should.

    Arnd
Herbert Xu Dec. 30, 2022, 3:14 p.m. UTC | #3
On Thu, Dec 15, 2022 at 05:29:38PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The memory sanitizer causes excessive register spills in this function:
> 
> crypto/wp512.c:782:13: error: stack frame size (2104) exceeds limit (2048) in 'wp512_process_buffer' [-Werror,-Wframe-larger-than]
> 
> Assume that this one is safe, and mark it as needing no checks to
> get the stack usage back down to the normal level.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  crypto/wp512.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/crypto/wp512.c b/crypto/wp512.c
index 5e820afa3c78..07994e5ebf4e 100644
--- a/crypto/wp512.c
+++ b/crypto/wp512.c
@@ -779,7 +779,7 @@  static const u64 rc[WHIRLPOOL_ROUNDS] = {
  * The core Whirlpool transform.
  */
 
-static void wp512_process_buffer(struct wp512_ctx *wctx) {
+static __no_kmsan_checks void wp512_process_buffer(struct wp512_ctx *wctx) {
 	int i, r;
 	u64 K[8];        /* the round key */
 	u64 block[8];    /* mu(buffer) */