mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
During randconfig testing, I came across a lot of warnings for the newly added carryless multiplication function triggering excessive stack usage from spilling temporary variables to the stack: lib/crypto/gf128hash.c:166:1: error: stack frame size (1192) exceeds limit (1024) in 'polyval_mul_generic' [-Werror,-Wframe-larger-than] In addition to the possible risk of overflowing the kernel stack, the generated object code surely performs very poorly. This only happens on architectures that don't provide uint128_t (which should be all 32-bit architectures on modern compilers), but though I tested random x86 and arm configs, I only saw this with arm's CONFIG_THUMB2_KERNEL, which adds more pressure to the register allocator. The testing was done using clang-22, I don't know if gcc has the same problem. Marking clmul32() as noinline_for_stack experimentally shows all of the affected builds to completely solve the problem, reducing the stack usage to a few bytes as expected. Since u64 arithmetic frequently leads to compilers badly optimizing 32-bit targets, keeping clmul32 out of line is likely to help on other 32-bit configurations as well when they run into this problem, though it may also result in a small performance degradation in configurations that would benefit from inlining. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20260611125952.3387258-1-arnd@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org> |
||
|---|---|---|
| .. | ||
| arm | ||
| arm64 | ||
| mips | ||
| mpi | ||
| powerpc | ||
| riscv | ||
| s390 | ||
| sparc | ||
| tests | ||
| x86 | ||
| .kunitconfig | ||
| aes.c | ||
| aescfb.c | ||
| aesgcm.c | ||
| arc4.c | ||
| blake2b.c | ||
| blake2s.c | ||
| chacha-block-generic.c | ||
| chacha.c | ||
| chacha20poly1305.c | ||
| curve25519-fiat32.c | ||
| curve25519-hacl64.c | ||
| curve25519.c | ||
| des.c | ||
| fips-mldsa.h | ||
| fips.h | ||
| gf128hash.c | ||
| gf128mul.c | ||
| hash_info.c | ||
| Kconfig | ||
| Makefile | ||
| md5.c | ||
| memneq.c | ||
| mldsa.c | ||
| nh.c | ||
| poly1305-donna32.c | ||
| poly1305-donna64.c | ||
| poly1305.c | ||
| sha1.c | ||
| sha3.c | ||
| sha256.c | ||
| sha512.c | ||
| simd.c | ||
| sm3.c | ||
| utils.c | ||