Skip to contentSkip to conversation

lib/crypto: blake2b: Limit frame size workaround to GCC

PATCH New Thorsten Blum 1 participant 1 message Nov 25, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 lib/crypto: blake2b: Limit frame size workaround to GCC

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.

---
Changes in v3:
- Add a comment and remove the end marker (Nathan)
- Link to v2: https://lore.kernel.org/lkml/[email protected]/

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/[email protected]/

---
 lib/crypto/Makefile | 5 +++++
 1 file changed, 5 insertions(+)
lib/crypto/Makefile +5 -0
index b5346cebbb55..79315717fb43 100644
@@ -33,7 +33,12 @@ obj-$(CONFIG_CRYPTO_LIB_GF128MUL)		+= gf128mul.o
 
 obj-$(CONFIG_CRYPTO_LIB_BLAKE2B) += libblake2b.o
 libblake2b-y := blake2b.o
+ifeq ($(CONFIG_CC_IS_GCC),y)
+# Please note that the bug affected only i386 and has been fixed since GCC 12.2.
+# However, modern GCC versions still generate very large stack frames on other
+# architectures.
 CFLAGS_blake2b.o := -Wframe-larger-than=4096 #  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105930
+endif
 ifeq ($(CONFIG_CRYPTO_LIB_BLAKE2B_ARCH),y)
 CFLAGS_blake2b.o += -I$(src)/$(SRCARCH)
 libblake2b-$(CONFIG_ARM) += arm/blake2b-neon-core.o
Signature · 2 lines
Thorsten Blum
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4