* [PATCH] crypto: jitterentropy: build without sanitizer
@ 2019-07-24 18:51 Arnd Bergmann
2019-08-02 4:55 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2019-07-24 18:51 UTC (permalink / raw)
To: Herbert Xu, David S. Miller
Cc: kasan-dev, Stephan Müller, Arnd Bergmann, Ard Biesheuvel,
Eric Biggers, Vitaly Chikunov, linux-crypto, linux-kernel,
clang-built-linux
Recent clang-9 snapshots double the kernel stack usage when building
this file with -O0 -fsanitize=kernel-hwaddress, compared to clang-8
and older snapshots, this changed between commits svn364966 and
svn366056:
crypto/jitterentropy.c:516:5: error: stack frame size of 2640 bytes in function 'jent_entropy_init' [-Werror,-Wframe-larger-than=]
int jent_entropy_init(void)
^
crypto/jitterentropy.c:185:14: error: stack frame size of 2224 bytes in function 'jent_lfsr_time' [-Werror,-Wframe-larger-than=]
static __u64 jent_lfsr_time(struct rand_data *ec, __u64 time, __u64 loop_cnt)
^
I prepared a reduced test case in case any clang developers want to
take a closer look, but from looking at the earlier output it seems
that even with clang-8, something was very wrong here.
Turn off any KASAN and UBSAN sanitizing for this file, as that likely
clashes with -O0 anyway. Turning off just KASAN avoids the warning
already, but I suspect both of these have undesired side-effects
for jitterentropy.
Link: https://godbolt.org/z/fDcwZ5
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
crypto/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/crypto/Makefile b/crypto/Makefile
index 9479e1a45d8c..176b2623dd68 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -136,6 +136,8 @@ obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_cprng.o
obj-$(CONFIG_CRYPTO_DRBG) += drbg.o
obj-$(CONFIG_CRYPTO_JITTERENTROPY) += jitterentropy_rng.o
CFLAGS_jitterentropy.o = -O0
+KASAN_SANITIZE_jitterentropy.o = n
+UBSAN_SANITIZE_jitterentropy.o = n
jitterentropy_rng-y := jitterentropy.o jitterentropy-kcapi.o
obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
obj-$(CONFIG_CRYPTO_GHASH) += ghash-generic.o
--
2.20.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: jitterentropy: build without sanitizer
2019-07-24 18:51 [PATCH] crypto: jitterentropy: build without sanitizer Arnd Bergmann
@ 2019-08-02 4:55 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2019-08-02 4:55 UTC (permalink / raw)
To: Arnd Bergmann
Cc: David S. Miller, kasan-dev, Stephan Müller, Ard Biesheuvel,
Eric Biggers, Vitaly Chikunov, linux-crypto, linux-kernel,
clang-built-linux
On Wed, Jul 24, 2019 at 08:51:55PM +0200, Arnd Bergmann wrote:
> Recent clang-9 snapshots double the kernel stack usage when building
> this file with -O0 -fsanitize=kernel-hwaddress, compared to clang-8
> and older snapshots, this changed between commits svn364966 and
> svn366056:
>
> crypto/jitterentropy.c:516:5: error: stack frame size of 2640 bytes in function 'jent_entropy_init' [-Werror,-Wframe-larger-than=]
> int jent_entropy_init(void)
> ^
> crypto/jitterentropy.c:185:14: error: stack frame size of 2224 bytes in function 'jent_lfsr_time' [-Werror,-Wframe-larger-than=]
> static __u64 jent_lfsr_time(struct rand_data *ec, __u64 time, __u64 loop_cnt)
> ^
>
> I prepared a reduced test case in case any clang developers want to
> take a closer look, but from looking at the earlier output it seems
> that even with clang-8, something was very wrong here.
>
> Turn off any KASAN and UBSAN sanitizing for this file, as that likely
> clashes with -O0 anyway. Turning off just KASAN avoids the warning
> already, but I suspect both of these have undesired side-effects
> for jitterentropy.
>
> Link: https://godbolt.org/z/fDcwZ5
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> crypto/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
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] 2+ messages in thread
end of thread, other threads:[~2019-08-02 4:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24 18:51 [PATCH] crypto: jitterentropy: build without sanitizer Arnd Bergmann
2019-08-02 4:55 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).