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: <Y6IcSgmXpGwWP+xK@gmail.com>
Date:   Tue, 20 Dec 2022 20:34:18 +0000
From:   Eric Biggers <ebiggers@...nel.org>
To:     Herbert Xu <herbert@...dor.apana.org.au>
Cc:     "Chen, Rong A" <rong.a.chen@...el.com>,
        kernel test robot <lkp@...el.com>,
        "Jason A. Donenfeld" <zx2c4@...nel.org>,
        oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Linux Crypto Mailing List <linux-crypto@...r.kernel.org>
Subject: Re: [PATCH] crypto: lib/blake2s - Split up test function to halve
 stack usage

On Sun, Dec 11, 2022 at 02:22:29PM +0800, Herbert Xu wrote:
> On Thu, Dec 08, 2022 at 02:37:45PM +0800, Chen, Rong A wrote:
> >
> > Thanks for the information, I checked the result of the fix commit,
> > it reduced the stack frame but the warning still exists:
> > 
> > lib/crypto/blake2s-selftest.c:632:1: warning: the frame size of 1056 bytes
> > is larger than 1024 bytes [-Wframe-larger-than=]
> 
> Sorry, I didn't realise that you could still reproduce it.  I tried
> reproducing it on multiple architectures and failed (all were in
> the 900 range).
> 
> Anyhow, this patch reduces it by half for me so hopefully it should
> put this to rest.
> 
> ---8<---
> Reduce the stack usage further by splitting up the test function.
> 
> Also squash blocks and unaligned_blocks into one array.
> 
> Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>
> 
> diff --git a/lib/crypto/blake2s-selftest.c b/lib/crypto/blake2s-selftest.c
> index 7d77dea15587..484b89332c83 100644
> --- a/lib/crypto/blake2s-selftest.c
> +++ b/lib/crypto/blake2s-selftest.c
> @@ -545,7 +545,7 @@ static const u8 blake2s_testvecs[][BLAKE2S_HASH_SIZE] __initconst = {
>      0xd6, 0x98, 0x6b, 0x07, 0x10, 0x65, 0x52, 0x65, },
>  };
>  
> -bool __init blake2s_selftest(void)
> +static bool __init blake2s_digest_test(void)
>  {
>  	u8 key[BLAKE2S_KEY_SIZE];
>  	u8 buf[ARRAY_SIZE(blake2s_testvecs)];
> @@ -589,11 +589,20 @@ bool __init blake2s_selftest(void)
>  		}
>  	}
>  
> +	return success;
> +}
> +
> +static bool __init blake2s_random_test(void)
> +{
> +	struct blake2s_state state;
> +	bool success = true;
> +	int i, l;
> +

Shouldn't these functions have 'noinline_for_stack' added to them?

- Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ