From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32B652F7AD6 for ; Tue, 25 Nov 2025 21:22:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764105742; cv=none; b=obDvoABCP+ylX0GiJ7LSB7XqYd1tRWa1It9C+gssnEjE0MxxxiojcTFLtFQ8yyoK1WtJLE6VTWc/QCfvHU4ftEqoKXrEAvQj0KETGZkmz5FE6k1wTMioRQDlOVuYNe5ybreJGscoPJaXoh6qnp6acDB20AlsjVWynVp6GMXVXk4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764105742; c=relaxed/simple; bh=IDw4YajmtepqggE88Zrt7rMaSzws+BX9vMTuwLAZgog=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=p06owazk7L9FPaGX+k9GatmROVy6HCjGZt7+HG0w9jBtQgd3CuzA6JpT3uSnUcdiM7JY6AdMv15RTh4gpJQZ1P+ntyCurj+OX8M9tHR4VCuStSu0JO5av1LS8DtSYfNWq9k4rn+nRzbYwjTgJgvvjJ701qBztJarUddoE6KHzQs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=cbjFjvzf; arc=none smtp.client-ip=95.215.58.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="cbjFjvzf" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1764105736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=xhUg5nVY4Nfo8QoiwbxmhJLK8s13nH/11xUV0X2e+T4=; b=cbjFjvzfheJKj46SeQ0Hy9TwBEVNJulhwhybfnnAMv55ycDaHFUbg27SMUWRBelu4tLUZL abKzrp8fqspyGfHPpY6MuWGmoSVY1A9MXKcAbJqReVLYeSfA7jchcEgADXvw4Gf1iR8zxp /Q2EuCNkhyEUExT0X6skP/6h3CoWbhw= From: Thorsten Blum To: Eric Biggers , "Jason A. Donenfeld" , Ard Biesheuvel , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: Thorsten Blum , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v3] lib/crypto: blake2b: Limit frame size workaround to GCC Date: Tue, 25 Nov 2025 22:21:51 +0100 Message-ID: <20251125212150.3486-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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. Reviewed-by: Nathan Chancellor Signed-off-by: Thorsten Blum --- Changes in v3: - Add a comment and remove the end marker (Nathan) - Link to v2: https://lore.kernel.org/lkml/20251123182515.548471-3-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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile index b5346cebbb55..79315717fb43 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -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 -- Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4