All of lore.kernel.org
 help / color / mirror / Atom feed
* [herbert-cryptodev-2.6:master 18/27] lib/crypto/blake2s-selftest.c:632:1: warning: the frame size of 1088 bytes is larger than 1024 bytes
@ 2022-06-20  0:32 kernel test robot
  2022-06-20  7:52 ` [PATCH] lib/crypto: blake2s: reduce stack frame usage in self test Jason A. Donenfeld
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2022-06-20  0:32 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: kbuild-all, linux-crypto, Herbert Xu

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
head:   bffa1fc065893a14703545efba7d69bb4082b18a
commit: 2d16803c562ecc644803d42ba98a8e0aef9c014e [18/27] crypto: blake2s - remove shash module
config: riscv-randconfig-r042-20220619 (https://download.01.org/0day-ci/archive/20220620/202206200851.gE3MHCgd-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git/commit/?id=2d16803c562ecc644803d42ba98a8e0aef9c014e
        git remote add herbert-cryptodev-2.6 https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
        git fetch --no-tags herbert-cryptodev-2.6 master
        git checkout 2d16803c562ecc644803d42ba98a8e0aef9c014e
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash lib/crypto/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   lib/crypto/blake2s-selftest.c: In function 'blake2s_selftest':
>> lib/crypto/blake2s-selftest.c:632:1: warning: the frame size of 1088 bytes is larger than 1024 bytes [-Wframe-larger-than=]
     632 | }
         | ^


vim +632 lib/crypto/blake2s-selftest.c

2d16803c562ecc Jason A. Donenfeld 2022-05-28  614  
2d16803c562ecc Jason A. Donenfeld 2022-05-28  615  		memcpy(&state1, &state, sizeof(state1));
2d16803c562ecc Jason A. Donenfeld 2022-05-28  616  		blake2s_compress(&state1, blocks, 1, BLAKE2S_BLOCK_SIZE);
2d16803c562ecc Jason A. Donenfeld 2022-05-28  617  		for (l = 1; l < TEST_ALIGNMENT; ++l) {
2d16803c562ecc Jason A. Donenfeld 2022-05-28  618  			memcpy(unaligned_block + l, blocks,
2d16803c562ecc Jason A. Donenfeld 2022-05-28  619  			       BLAKE2S_BLOCK_SIZE);
2d16803c562ecc Jason A. Donenfeld 2022-05-28  620  			memcpy(&state2, &state, sizeof(state2));
2d16803c562ecc Jason A. Donenfeld 2022-05-28  621  			blake2s_compress(&state2, unaligned_block + l, 1,
2d16803c562ecc Jason A. Donenfeld 2022-05-28  622  					 BLAKE2S_BLOCK_SIZE);
2d16803c562ecc Jason A. Donenfeld 2022-05-28  623  			if (memcmp(&state1, &state2, sizeof(state1))) {
2d16803c562ecc Jason A. Donenfeld 2022-05-28  624  				pr_err("blake2s random compress align %d self-test %d: FAIL\n",
2d16803c562ecc Jason A. Donenfeld 2022-05-28  625  				       l, i + 1);
2d16803c562ecc Jason A. Donenfeld 2022-05-28  626  				success = false;
2d16803c562ecc Jason A. Donenfeld 2022-05-28  627  			}
2d16803c562ecc Jason A. Donenfeld 2022-05-28  628  		}
2d16803c562ecc Jason A. Donenfeld 2022-05-28  629  	}
2d16803c562ecc Jason A. Donenfeld 2022-05-28  630  
66d7fb94e4ffe5 Jason A. Donenfeld 2019-11-08  631  	return success;
66d7fb94e4ffe5 Jason A. Donenfeld 2019-11-08 @632  }

:::::: The code at line 632 was first introduced by commit
:::::: 66d7fb94e4ffe5acc589e0b2b4710aecc1f07a28 crypto: blake2s - generic C library implementation and selftest

:::::: TO: Jason A. Donenfeld <Jason@zx2c4.com>
:::::: CC: Herbert Xu <herbert@gondor.apana.org.au>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] lib/crypto: blake2s: reduce stack frame usage in self test
  2022-06-20  0:32 [herbert-cryptodev-2.6:master 18/27] lib/crypto/blake2s-selftest.c:632:1: warning: the frame size of 1088 bytes is larger than 1024 bytes kernel test robot
@ 2022-06-20  7:52 ` Jason A. Donenfeld
  2022-06-30  8:12   ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Jason A. Donenfeld @ 2022-06-20  7:52 UTC (permalink / raw)
  To: linux-crypto, Herbert Xu; +Cc: Jason A. Donenfeld, kernel test robot

Using 3 blocks here doesn't give us much more than using 2, and it
causes a stack frame size warning on certain compiler/config/arch
combinations:

   lib/crypto/blake2s-selftest.c: In function 'blake2s_selftest':
>> lib/crypto/blake2s-selftest.c:632:1: warning: the frame size of 1088 bytes is larger than 1024 bytes [-Wframe-larger-than=]
     632 | }
         | ^

So this patch just reduces the block from 3 to 2, which makes the
warning go away.

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/linux-crypto/202206200851.gE3MHCgd-lkp@intel.com
Fixes: 2d16803c562e ("crypto: blake2s - remove shash module")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 lib/crypto/blake2s-selftest.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/crypto/blake2s-selftest.c b/lib/crypto/blake2s-selftest.c
index 66f505220f43..7d77dea15587 100644
--- a/lib/crypto/blake2s-selftest.c
+++ b/lib/crypto/blake2s-selftest.c
@@ -593,7 +593,7 @@ bool __init blake2s_selftest(void)
 		enum { TEST_ALIGNMENT = 16 };
 		u8 unaligned_block[BLAKE2S_BLOCK_SIZE + TEST_ALIGNMENT - 1]
 					__aligned(TEST_ALIGNMENT);
-		u8 blocks[BLAKE2S_BLOCK_SIZE * 3];
+		u8 blocks[BLAKE2S_BLOCK_SIZE * 2];
 		struct blake2s_state state1, state2;
 
 		get_random_bytes(blocks, sizeof(blocks));
@@ -603,8 +603,8 @@ bool __init blake2s_selftest(void)
     defined(CONFIG_CRYPTO_ARCH_HAVE_LIB_BLAKE2S)
 		memcpy(&state1, &state, sizeof(state1));
 		memcpy(&state2, &state, sizeof(state2));
-		blake2s_compress(&state1, blocks, 3, BLAKE2S_BLOCK_SIZE);
-		blake2s_compress_generic(&state2, blocks, 3, BLAKE2S_BLOCK_SIZE);
+		blake2s_compress(&state1, blocks, 2, BLAKE2S_BLOCK_SIZE);
+		blake2s_compress_generic(&state2, blocks, 2, BLAKE2S_BLOCK_SIZE);
 		if (memcmp(&state1, &state2, sizeof(state1))) {
 			pr_err("blake2s random compress self-test %d: FAIL\n",
 			       i + 1);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] lib/crypto: blake2s: reduce stack frame usage in self test
  2022-06-20  7:52 ` [PATCH] lib/crypto: blake2s: reduce stack frame usage in self test Jason A. Donenfeld
@ 2022-06-30  8:12   ` Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2022-06-30  8:12 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: linux-crypto, kernel test robot

On Mon, Jun 20, 2022 at 09:52:43AM +0200, Jason A. Donenfeld wrote:
> Using 3 blocks here doesn't give us much more than using 2, and it
> causes a stack frame size warning on certain compiler/config/arch
> combinations:
> 
>    lib/crypto/blake2s-selftest.c: In function 'blake2s_selftest':
> >> lib/crypto/blake2s-selftest.c:632:1: warning: the frame size of 1088 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>      632 | }
>          | ^
> 
> So this patch just reduces the block from 3 to 2, which makes the
> warning go away.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/linux-crypto/202206200851.gE3MHCgd-lkp@intel.com
> Fixes: 2d16803c562e ("crypto: blake2s - remove shash module")
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  lib/crypto/blake2s-selftest.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-30  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-20  0:32 [herbert-cryptodev-2.6:master 18/27] lib/crypto/blake2s-selftest.c:632:1: warning: the frame size of 1088 bytes is larger than 1024 bytes kernel test robot
2022-06-20  7:52 ` [PATCH] lib/crypto: blake2s: reduce stack frame usage in self test Jason A. Donenfeld
2022-06-30  8:12   ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.