linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: curve25519-hacl64 - Disable fortify-source for clang-10
@ 2020-05-05 13:59 Arnd Bergmann
  2020-05-05 21:39 ` Jason A. Donenfeld
  0 siblings, 1 reply; 20+ messages in thread
From: Arnd Bergmann @ 2020-05-05 13:59 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Arnd Bergmann, Jason A . Donenfeld, Ard Biesheuvel, linux-crypto,
	linux-kernel, clang-built-linux

clang-10 produces a warning about excessive stack usage, as well
as rather unoptimized object code when CONFIG_FORTIFY_SOURCE is
set:

lib/crypto/curve25519-hacl64.c:759:6: error: stack frame size of 2400 bytes in function 'curve25519_generic' [-Werror,-Wframe-larger-than=]

Jason Donenfeld managed to track this down to the usage of
CONFIG_FORTIFY_SOURCE, and I found a minimal test case that illustrates
this happening on clang-10 but not clang-9 or clang-11.

To work around this, turn off fortification in this file.

Link: https://bugs.llvm.org/show_bug.cgi?id=45802
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 lib/crypto/curve25519-hacl64.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/crypto/curve25519-hacl64.c b/lib/crypto/curve25519-hacl64.c
index c7de61829a66..87adeb4f9276 100644
--- a/lib/crypto/curve25519-hacl64.c
+++ b/lib/crypto/curve25519-hacl64.c
@@ -10,6 +10,10 @@
  * integer types.
  */
 
+#if (CONFIG_CLANG_VERSION >= 100000) && (CONFIG_CLANG_VERSION < 110000)
+#define __NO_FORTIFY /* https://bugs.llvm.org/show_bug.cgi?id=45802 */
+#endif
+
 #include <asm/unaligned.h>
 #include <crypto/curve25519.h>
 #include <linux/string.h>
-- 
2.26.0


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

end of thread, other threads:[~2020-05-06 16:49 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 13:59 [PATCH] crypto: curve25519-hacl64 - Disable fortify-source for clang-10 Arnd Bergmann
2020-05-05 21:39 ` Jason A. Donenfeld
2020-05-05 21:48   ` Nick Desaulniers
2020-05-05 21:49     ` Jason A. Donenfeld
2020-05-05 21:55   ` [PATCH] Kbuild: disable FORTIFY_SOURCE on clang-10 Jason A. Donenfeld
2020-05-05 22:02     ` Nick Desaulniers
2020-05-05 22:25       ` Nathan Chancellor
2020-05-05 22:37         ` George Burgess IV
2020-05-05 22:37         ` Jason A. Donenfeld
2020-05-05 23:19           ` Kees Cook
2020-05-05 23:22             ` Jason A. Donenfeld
2020-05-05 23:22               ` Jason A. Donenfeld
2020-05-05 23:36               ` Nick Desaulniers
2020-05-06  2:53                 ` Kees Cook
2020-05-06  0:14             ` [PATCH v2] security: disable FORTIFY_SOURCE on clang Jason A. Donenfeld
2020-05-06  0:57               ` Nick Desaulniers
2020-05-06  2:54               ` Kees Cook
2020-05-06  3:34                 ` Jason A. Donenfeld
2020-05-06  3:53                 ` Nathan Chancellor
2020-05-06 16:48                   ` George Burgess

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).