Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10644036pxu; Wed, 30 Dec 2020 07:49:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0dFh4t2D8MOoGNwy3QKgnBwn39s/gHmhQPwNTMXSaV8TyiUotR7vipo4k6gQPDs1nItox X-Received: by 2002:a50:dacd:: with SMTP id s13mr51705909edj.173.1609343397816; Wed, 30 Dec 2020 07:49:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609343397; cv=none; d=google.com; s=arc-20160816; b=wwkkhRvILehJQxBpzM2Fo88pSPCbCzmWFDooYD8sWsmY5E6ImbTaTA877da333wEzo k6C3mWOdwPNXeaysipoGMN6cghIh8HIYOrynXH5yxjYdQX1ad+4J3qh1IfF0Nz6WBTYB wSJJeJaVoVAzCsMx44qax4HkF2MswdKm9ZRL7NLv3sC/yvo6ML7K+om7ha45pPDOIA2r n9pPBo/nnVQ6ux8h27ayqNY3p/BVls3uRjv+qQVR8dXtMyBOdIHLb7VgNFyFV6KkuiMa GZz9E3h1dxgk8DGulIpubisSag1yuv+lk6MSTlzfZGWgyYQ7wu04xR792PVKR5BvkMQ1 57GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=y+yCv1woZ+5bYgVq/N1G5C6T3WyijeMfIHRB8GVDgd0=; b=JKbt375P56W0Z1nNyTmIBplhOykrhrBhDa46hBkWm5eOA4vcu3QRgLaz7MWa8X/7x4 7JK4mCVaeBt7g+E0ftyyw7niTrk5ysIOdjzXcl6h4oUbiw862UWwvS7MJkS9uUurOpvT zAfgBCqOz5HCduYf6CNGRFiCoR0jgvzHGLsLkyPmTbwlXnPG5lj38RFP3NrfjKc22XNd A7zbEeeCm0amh1jRsbQfBCDPW6BIfnnzXmrElAYtBYNXzyniifNBHPrpuVDNclLT3+sX Cn7yYBbHMQJtkeXL3q1XZ8xvjiauY0YMzuTSwNswtVmMUVUpKXn0UJ1lheAWY+07G5AS Cj4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QXphXNuQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di28si20635824edb.383.2020.12.30.07.49.34; Wed, 30 Dec 2020 07:49:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QXphXNuQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726500AbgL3Pse (ORCPT + 99 others); Wed, 30 Dec 2020 10:48:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:46504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726214AbgL3Pse (ORCPT ); Wed, 30 Dec 2020 10:48:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B291221FA; Wed, 30 Dec 2020 15:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1609343273; bh=vBYeDCgOLFmbNPmETuajmSAtm33RRNayRLyoFoCHSrY=; h=From:To:Cc:Subject:Date:From; b=QXphXNuQKEJ1/HDJRty278cbV37eRN7AUufjsysI9oEKN7trELi1Rg3DHUVb4Jl7G o4ByG+8ipcJJsYduu9PNfzZWCaMIR1ffEE4qreJecc8QVZx8FgKlHHdcnVOkIiENxn 37cjeYXjL2ZOJiwtYR0ATzT4yd6a3r5MYXHPFBOcS3vXg3jUJsswD9vOpU7g+SMwOf xta3U8QagccOEY+TM+7VkDcNdup4pElj4JC/18imPEIHdCI7bhQpiHs9tvDhpoTFEU CEqbNoreQywMBPo3m7TjyAJTCmbCuRL2pd4yfmSbEjIInukh4kufInrvxHaQE0bi55 ilf43KYL2ID5A== From: Arnd Bergmann To: Kees Cook Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Andrew Morton , Marco Elver , George Popescu , Stephen Rothwell , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] ubsan: disable unsigned-integer-overflow sanitizer with clang Date: Wed, 30 Dec 2020 16:47:35 +0100 Message-Id: <20201230154749.746641-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Building ubsan kernels even for compile-testing introduced these warnings in my randconfig environment: crypto/blake2b_generic.c:98:13: error: stack frame size of 9636 bytes in function 'blake2b_compress' [-Werror,-Wframe-larger-than=] static void blake2b_compress(struct blake2b_state *S, crypto/sha512_generic.c:151:13: error: stack frame size of 1292 bytes in function 'sha512_generic_block_fn' [-Werror,-Wframe-larger-than=] static void sha512_generic_block_fn(struct sha512_state *sst, u8 const *src, lib/crypto/curve25519-fiat32.c:312:22: error: stack frame size of 2180 bytes in function 'fe_mul_impl' [-Werror,-Wframe-larger-than=] static noinline void fe_mul_impl(u32 out[10], const u32 in1[10], const u32 in2[10]) lib/crypto/curve25519-fiat32.c:444:22: error: stack frame size of 1588 bytes in function 'fe_sqr_impl' [-Werror,-Wframe-larger-than=] static noinline void fe_sqr_impl(u32 out[10], const u32 in1[10]) Further testing showed that this is caused by -fsanitize=unsigned-integer-overflow. The one in blake2b immediately overflows the 8KB stack area on 32-bit architectures, so better ensure this never happens by making this option gcc-only. Fixes: d0a3ac549f38 ("ubsan: enable for all*config builds") Signed-off-by: Arnd Bergmann --- lib/Kconfig.ubsan | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan index 8b635fd75fe4..e23873282ba7 100644 --- a/lib/Kconfig.ubsan +++ b/lib/Kconfig.ubsan @@ -122,6 +122,8 @@ config UBSAN_SIGNED_OVERFLOW config UBSAN_UNSIGNED_OVERFLOW bool "Perform checking for unsigned arithmetic overflow" + # clang hugely expands stack usage with -fsanitize=object-size + depends on !CC_IS_CLANG depends on $(cc-option,-fsanitize=unsigned-integer-overflow) help This option enables -fsanitize=unsigned-integer-overflow which checks -- 2.29.2