From nobody Mon Jun 8 20:41:14 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 C180B3FFAB9 for ; Tue, 26 May 2026 14:50:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779807060; cv=none; b=DCXW/tiTTt5lAlJuqKdjQZlqYqBS1MY8NF8Um3YyVNH8lzVyRDTdCFFGh77qgLbJOn13ezL8fK4DCsp2voyMGDu3JGTyljI1oWIHvVns0LkX8tsDul4n4zVQ9TKTtL+NuYmxU4j6zbnOnnSTV2N9S7MbinE1Xf/jnDdB2zxpo78= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779807060; c=relaxed/simple; bh=L6pzUfmu0bZCo0lj09IS9qgzbK9vbAC7k9hmmlS4JWA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=CkseAmIFQpEmQcirXtMsXlIX69cKZaSIkdAKbAJuWcLut1spX7rv+s0gJnU/Vsawd5T4iMh/7zzPWWMQr3mGAHXgy5cX1l+kVAJMCSyJqKVN+ZOEmzkN2wldXWhLbPiYkXuF9bHnqHaFZJXKeDXyApPKTNccblDIvEgu4gJD5kM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A3Cxx9y8; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A3Cxx9y8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 534EF1F000E9; Tue, 26 May 2026 14:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779807059; bh=ItbZ4aHGz4QJMHITkowi7I/HwxJH8EVodvBL1Jf1ub4=; h=From:To:Cc:Subject:Date; b=A3Cxx9y8HVh1TJ6imCZyqDq4DB09KIzHrjLpboCTPjjp5wZlgHJK9/VH+2wUjIOXn CVQ9KemnRjr0yH4PQUOZ/+D4vxaKTEbXDuq7yMP71gFVAZvkHiZRbs5BXhTFoqk/F7 RNDLQGq82H1zEitt7v9+Cexi08/2UFAObxrPfndj3SYYyWRcQrYKa4ZxBShb+HTQsR 3exANresX1LkKNcqbfzncFGYmIuP5znE8j6KsYNyztFyKfkWuAHp5vvy1OnfR7fLME gqkhD0IsRXBu++VXPq+ERpc7vb9aQVS8iCEY1/S7kwY+jPq+5lt9KYXvN7ej4lSAyy jQjH3HZbX33EA== From: Arnd Bergmann To: Nick Terrell , David Sterba Cc: Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH] zstd: reducing inlining for KASAN_STACK Date: Tue, 26 May 2026 16:50:43 +0200 Message-Id: <20260526145050.3004668-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann The zstd code forces inlining to improve code generation with most compiler versions. However, when CONFIG_KASAN_STACK is enabled, it has the opposite effect by causing excessive spilling of local variables to the stack, to the point where the stack warning limit is exceeded: lib/zstd/decompress/huf_decompress.c: In function 'HUF_decompress4X2_usingD= Table_internal_default': lib/zstd/decompress/huf_decompress.c:1512:1: error: the frame size of 1616 = bytes is larger than 1536 bytes [-Werror=3Dframe-larger-than=3D] cc1: all warnings being treated as errors lib/zstd/decompress/zstd_decompress_block.c: In function 'ZSTD_decompressSe= quencesLong_body.constprop': lib/zstd/decompress/zstd_decompress_block.c:1889:1: error: the frame size o= f 1584 bytes is larger than 1536 bytes [-Werror=3Dframe-larger-than=3D] Disable the extra inlining in this configuration and rely on the normal compiler heuristics instead. Signed-off-by: Arnd Bergmann --- lib/zstd/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/zstd/Makefile b/lib/zstd/Makefile index be218b5e0ed5..3909df12116b 100644 --- a/lib/zstd/Makefile +++ b/lib/zstd/Makefile @@ -8,6 +8,13 @@ # in the COPYING file in the root directory of this source tree). # You may select, at your option, one of the above-listed licenses. # ################################################################ + +ifdef CONFIG_KASAN_STACK +# with address sanitizer, the forced inlining produces worse +# code and and risks stack overflow +subdir-ccflags-y +=3D -DZSTD_NO_INLINE +endif + obj-$(CONFIG_ZSTD_COMPRESS) +=3D zstd_compress.o obj-$(CONFIG_ZSTD_DECOMPRESS) +=3D zstd_decompress.o obj-$(CONFIG_ZSTD_COMMON) +=3D zstd_common.o --=20 2.39.5