* [PATCH v2] lib/crypto: blake2b: Limit frame size workaround to GCC
@ 2025-11-23 18:25 Thorsten Blum
2025-11-23 21:13 ` Nathan Chancellor
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-11-23 18:25 UTC (permalink / raw)
To: Eric Biggers, Jason A. Donenfeld, Ard Biesheuvel,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt
Cc: Thorsten Blum, linux-crypto, linux-kernel, llvm
The GCC regression only affected i386 and has been fixed since GCC 12.2.
However, modern GCC versions still generate large stack frames on other
architectures (e.g., 3440 bytes for blake2b_compress_generic() on m68k
with GCC 15.1.0). Clang handles these functions efficiently and should
work fine with the default warning threshold.
Limit the frame size workaround to GCC only.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
Changes in v2:
- Restrict frame size workaround to GCC independent of its version or
the architecture
- Update patch title and description
- Link to v1: https://lore.kernel.org/lkml/20251122105530.441350-2-thorsten.blum@linux.dev/
---
lib/crypto/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile
index b5346cebbb55..95a48393ffb4 100644
--- a/lib/crypto/Makefile
+++ b/lib/crypto/Makefile
@@ -33,7 +33,9 @@ obj-$(CONFIG_CRYPTO_LIB_GF128MUL) += gf128mul.o
obj-$(CONFIG_CRYPTO_LIB_BLAKE2B) += libblake2b.o
libblake2b-y := blake2b.o
+ifeq ($(CONFIG_CC_IS_GCC),y)
CFLAGS_blake2b.o := -Wframe-larger-than=4096 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105930
+endif # CONFIG_CC_IS_GCC
ifeq ($(CONFIG_CRYPTO_LIB_BLAKE2B_ARCH),y)
CFLAGS_blake2b.o += -I$(src)/$(SRCARCH)
libblake2b-$(CONFIG_ARM) += arm/blake2b-neon-core.o
--
2.51.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] lib/crypto: blake2b: Limit frame size workaround to GCC
2025-11-23 18:25 [PATCH v2] lib/crypto: blake2b: Limit frame size workaround to GCC Thorsten Blum
@ 2025-11-23 21:13 ` Nathan Chancellor
0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2025-11-23 21:13 UTC (permalink / raw)
To: Thorsten Blum
Cc: Eric Biggers, Jason A. Donenfeld, Ard Biesheuvel,
Nick Desaulniers, Bill Wendling, Justin Stitt, linux-crypto,
linux-kernel, llvm
On Sun, Nov 23, 2025 at 07:25:17PM +0100, Thorsten Blum wrote:
> The GCC regression only affected i386 and has been fixed since GCC 12.2.
> However, modern GCC versions still generate large stack frames on other
> architectures (e.g., 3440 bytes for blake2b_compress_generic() on m68k
> with GCC 15.1.0). Clang handles these functions efficiently and should
> work fine with the default warning threshold.
>
> Limit the frame size workaround to GCC only.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Since the below comments are mostly nits:
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Changes in v2:
> - Restrict frame size workaround to GCC independent of its version or
> the architecture
> - Update patch title and description
> - Link to v1: https://lore.kernel.org/lkml/20251122105530.441350-2-thorsten.blum@linux.dev/
> ---
> lib/crypto/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile
> index b5346cebbb55..95a48393ffb4 100644
> --- a/lib/crypto/Makefile
> +++ b/lib/crypto/Makefile
> @@ -33,7 +33,9 @@ obj-$(CONFIG_CRYPTO_LIB_GF128MUL) += gf128mul.o
>
> obj-$(CONFIG_CRYPTO_LIB_BLAKE2B) += libblake2b.o
> libblake2b-y := blake2b.o
> +ifeq ($(CONFIG_CC_IS_GCC),y)
I tend to prefer
ifdef CONFIG_CC_IS_GCC
when the symbol is bool since it is a little easier to understand.
It may be worth a comment about the warnings on other architectures to
help future travellers who may be tempted to remove this when the
fixed GCC version of that bug report becomes the minimum.
> CFLAGS_blake2b.o := -Wframe-larger-than=4096 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105930
> +endif # CONFIG_CC_IS_GCC
This conditional feels small enough that it does not need this marker
but I guess that is maintainer preference.
> ifeq ($(CONFIG_CRYPTO_LIB_BLAKE2B_ARCH),y)
> CFLAGS_blake2b.o += -I$(src)/$(SRCARCH)
> libblake2b-$(CONFIG_ARM) += arm/blake2b-neon-core.o
> --
> 2.51.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-23 21:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-23 18:25 [PATCH v2] lib/crypto: blake2b: Limit frame size workaround to GCC Thorsten Blum
2025-11-23 21:13 ` Nathan Chancellor
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).