From nobody Sat Feb 7 22:07:10 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0E54E1624E9; Sat, 3 May 2025 18:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746297987; cv=none; b=LUjjTFRMGXGF7k9tKC5r6eluXz2Cv0/8uVOKD1MLw2nzSEfR0k9iYUmgFot3fDAooqa9wGQylgxlEXb5BQqi5VqrId8IdHyD5LIN3lsHjzqzuDLoJbBfVUxLfVTJvbHPtdb09qNpwkzO9Sx77Q04MMe6BSQYtsGmoQIPxC3cTzk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746297987; c=relaxed/simple; bh=vcmcNB9M/mnVV0u1TxfACvPzuwlKwH4U0CbHSsTxvvI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LTV9uPovcfUVpx0R0fNBn8a6AZnVPuNXlr4YIg0hS/I0w6ORPbyxAbFMS2pAL95YpjjFEqLtOSNtfnMeBMWPeHQZ2/ee+EbiZcRiAcdF0QKyqQLYRXvjs4acVJfrDdSHkIS0zDc6FjeXokPKVeQ95Q1wuF+YSXES2Blq3+whyiU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E/5UvviY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="E/5UvviY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80319C4AF0B; Sat, 3 May 2025 18:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746297986; bh=vcmcNB9M/mnVV0u1TxfACvPzuwlKwH4U0CbHSsTxvvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E/5UvviYXd4M/OBy3fCYKWszd1r5TVBDxzzXa7gIW6vO6mFVvSMi54bi4L3Uwhs1g PLzjB05PAVxHMjRVuzOHqmdYVq4m5w7qJrugDaGHCthgNxITLShvMcjsSNJrNG5tIn Tsvbg55gZqviiFr4CixWjxeEH65ktOuo79s19KniMgtvIG6c8rA5JDn6aFdQ4RACmX 3hxFSp7SDdxrhq28NWPPIatdxubInTKge/hEATyNT0ghtVG173sO6TSKjDKuq+6SSa rfiX9QESpHzV8mIM/SdJ4UoN2CFpw5tA4fIHuzXcdey1KFJlUcwgkMHGYwmpzQ0fF7 a21e4Ah5ghrUA== From: Kees Cook To: Masahiro Yamada Cc: Kees Cook , Nicolas Schier , Nathan Chancellor , linux-hardening@vger.kernel.org, linux-kbuild@vger.kernel.org, Petr Pavlu , Sebastian Andrzej Siewior , Justin Stitt , Marco Elver , Andrey Konovalov , Andrey Ryabinin , Nick Desaulniers , Bill Wendling , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, llvm@lists.linux.dev Subject: [PATCH v3 1/3] gcc-plugins: Force full rebuild when plugins change Date: Sat, 3 May 2025 11:46:18 -0700 Message-Id: <20250503184623.2572355-1-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250503184001.make.594-kees@kernel.org> References: <20250503184001.make.594-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4099; i=kees@kernel.org; h=from:subject; bh=vcmcNB9M/mnVV0u1TxfACvPzuwlKwH4U0CbHSsTxvvI=; b=owGbwMvMwCVmps19z/KJym7G02pJDBliyftYMz0PPeCzUN3AeedYZIn/ro+vFtTaZi1jryxji P75JD6uo5SFQYyLQVZMkSXIzj3OxeNte7j7XEWYOaxMIEMYuDgFYCI9nQx/eAXnbl5/btvnlRlX neQ7dc5/2MPWInTRLi1CKTM3dB1fOyPDsRulL/9NuPHAXNpf6bDhB6OrK7VcI7jMZ5xn+2H9ye0 kLwA= X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There was no dependency between the plugins changing and the rest of the kernel being built. This could cause strange behaviors as instrumentation could vary between targets depending on when they were built. Generate a new header file, gcc-plugins.h, any time the GCC plugins change. Include the header file in compiler-version.h when its associated feature name, GCC_PLUGINS, is defined. This will be picked up by fixdep and force rebuilds where needed. Add a generic "touch" kbuild command, which will be used again in a following patch. Add a "normalize_path" string helper to make the "TOUCH" output less ugly. Signed-off-by: Kees Cook Reviewed-by: Nicolas Schier Tested-by: Nicolas Schier --- Cc: Masahiro Yamada Cc: Nicolas Schier Cc: Nathan Chancellor Cc: Cc: --- include/linux/compiler-version.h | 4 ++++ scripts/Makefile.gcc-plugins | 2 +- scripts/Makefile.lib | 18 ++++++++++++++++++ scripts/gcc-plugins/Makefile | 4 ++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/include/linux/compiler-version.h b/include/linux/compiler-vers= ion.h index 573fa85b6c0c..74ea11563ce3 100644 --- a/include/linux/compiler-version.h +++ b/include/linux/compiler-version.h @@ -12,3 +12,7 @@ * and add dependency on include/config/CC_VERSION_TEXT, which is touched * by Kconfig when the version string from the compiler changes. */ + +#ifdef GCC_PLUGINS +#include +#endif diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins index 5b8a8378ca8a..e50dc931be49 100644 --- a/scripts/Makefile.gcc-plugins +++ b/scripts/Makefile.gcc-plugins @@ -38,7 +38,7 @@ export DISABLE_STACKLEAK_PLUGIN =20 # All the plugin CFLAGS are collected here in case a build target needs to # filter them out of the KBUILD_CFLAGS. -GCC_PLUGINS_CFLAGS :=3D $(strip $(addprefix -fplugin=3D$(objtree)/scripts/= gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) +GCC_PLUGINS_CFLAGS :=3D $(strip $(addprefix -fplugin=3D$(objtree)/scripts/= gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) -DGCC_PLUGINS export GCC_PLUGINS_CFLAGS =20 # Add the flags to the build! diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 2fe73cda0bdd..6fc2a82ee3bb 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -296,6 +296,19 @@ $(foreach m, $1, \ $(addprefix $(obj)/, $(call suffix-search, $(patsubst $(obj)/%,%,$m), $2,= $3)))) endef =20 +# Remove ".." and "." from a path, without using "realpath" +# Usage: +# $(call normalize_path,path/to/../file) +define normalize_path +$(strip $(eval elements :=3D) \ +$(foreach elem,$(subst /, ,$1), \ + $(if $(filter-out .,$(elem)), \ + $(if $(filter ..,$(elem)), \ + $(eval elements :=3D $(wordlist 2,$(words $(elements)),x $(elements)))= , \ + $(eval elements :=3D $(elements) $(elem))))) \ +$(subst $(space),/,$(elements))) +endef + # Build commands # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D # These are shared by some Makefile.* files. @@ -343,6 +356,11 @@ quiet_cmd_copy =3D COPY $@ $(obj)/%: $(src)/%_shipped $(call cmd,copy) =20 +# Touch a file +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D +quiet_cmd_touch =3D TOUCH $(call normalize_path,$@) + cmd_touch =3D touch $@ + # Commands useful for building a boot image # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D # diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile index 320afd3cf8e8..05b14aba41ef 100644 --- a/scripts/gcc-plugins/Makefile +++ b/scripts/gcc-plugins/Makefile @@ -66,3 +66,7 @@ quiet_cmd_plugin_cxx_o_c =3D HOSTCXX $@ =20 $(plugin-objs): $(obj)/%.o: $(src)/%.c FORCE $(call if_changed_dep,plugin_cxx_o_c) + +$(obj)/../../include/generated/gcc-plugins.h: $(plugin-single) $(plugin-mu= lti) FORCE + $(call if_changed,touch) +always-y +=3D ../../include/generated/gcc-plugins.h --=20 2.34.1 From nobody Sat Feb 7 22:07:10 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0E5EA170A2B; Sat, 3 May 2025 18:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746297987; cv=none; b=MyA4hA6QIUDhfHbq97nmcSFmdNEQdTXHzK3GqkyCd/rCuvTQJf/ipxWbalekr5bBz1Zbli0p8vamePEeMTkSQS7RBogpbz9IpeTWHZASxqu95JbEV9slVAwUpZlrS4RMm6cZrKL9tsyk61OfUpntSL89Sw77Je5H91ny6jP4+u0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746297987; c=relaxed/simple; bh=/4TdTrc4aB0kiFO9JBIxqORcQZGXnaXh7CndlvLLjw4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fUFsW+biDhiTjAL3RvP9O7MuX+CPKZKsq2rGOyRKkRYAaova4wEGHFadH77sYvN33iQWCXDdijIBBxV5qLTb2yZjdhmHnbK5ZWcgmf88DYXSWnlrTNpShRnrGEdWTpPtS1Xt5ql8aWmYTNTfnXFop/zlKNI/3iiVDUcJT2/3wjs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gOIPfsz9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gOIPfsz9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E60BC4CEEF; Sat, 3 May 2025 18:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746297986; bh=/4TdTrc4aB0kiFO9JBIxqORcQZGXnaXh7CndlvLLjw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gOIPfsz9QjVz4I8M3cqzI3vqMbbg4ALmRsWvKoeQ1baBKmQ/SK4jlyFnXER6Aym0b cFKi1sA8BcL4Wpvtc66A/dJIkB2/7eVNbUFgpyZA5mP6VcdzsPC5ad9zVnKh0ch6gp jeTagF0HarqFUGUTEj58W1ASZl+9ErViq3svQZrRHQwcQ38S2apnmTF4toNKKzPq/F v970X2AjJX+LAlZKRm98VyhuAibIwEroXnTS6hgicex8mzPsLlFY4PHhVvVgHozwnD XTsNbqdKAh0kbcyDxX92OpRBA5e3scwRIzczU66RSy7erb2NRjAXbD9sfB8hb2tL43 bUvDClK2xCq1g== From: Kees Cook To: Masahiro Yamada Cc: Kees Cook , Nathan Chancellor , Nicolas Schier , Petr Pavlu , Sebastian Andrzej Siewior , linux-kbuild@vger.kernel.org, Justin Stitt , Marco Elver , Andrey Konovalov , Andrey Ryabinin , Nick Desaulniers , Bill Wendling , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, kasan-dev@googlegroups.com, llvm@lists.linux.dev Subject: [PATCH v3 2/3] randstruct: Force full rebuild when seed changes Date: Sat, 3 May 2025 11:46:19 -0700 Message-Id: <20250503184623.2572355-2-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250503184001.make.594-kees@kernel.org> References: <20250503184001.make.594-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1638; i=kees@kernel.org; h=from:subject; bh=/4TdTrc4aB0kiFO9JBIxqORcQZGXnaXh7CndlvLLjw4=; b=owGbwMvMwCVmps19z/KJym7G02pJDBliyfv3J+WtzL589uiKhFWFjQuOu8ux+8/5JB98+dIOh kKRL4WfO0pYGMS4GGTFFFmC7NzjXDzetoe7z1WEmcPKBDKEgYtTACbi/pmR4Yj4wy3Pn+jVqpiI 8u5tnxmo0l9VHWgYwnHUS/Pi10eiJQw/Lvo8PqCVcGZOuLiG2bfzc6eLdL+15NuTJH6iceJDtVo GAA== X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" While the randstruct GCC plugin was being rebuilt if the randstruct seed changed, Clang builds did not notice the change. This could result in differing struct layouts in a target depending on when it was built. Include the existing generated header file in compiler-version.h when its associated feature name, RANDSTRUCT, is defined. This will be picked up by fixdep and force rebuilds where needed. Signed-off-by: Kees Cook Reviewed-by: Nicolas Schier Tested-by: Nicolas Schier --- Cc: Masahiro Yamada Cc: Nathan Chancellor Cc: Nicolas Schier Cc: Petr Pavlu Cc: Sebastian Andrzej Siewior Cc: --- include/linux/compiler-version.h | 3 +++ include/linux/vermagic.h | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/compiler-version.h b/include/linux/compiler-vers= ion.h index 74ea11563ce3..69b29b400ce2 100644 --- a/include/linux/compiler-version.h +++ b/include/linux/compiler-version.h @@ -16,3 +16,6 @@ #ifdef GCC_PLUGINS #include #endif +#ifdef RANDSTRUCT +#include +#endif diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h index 939ceabcaf06..335c360d4f9b 100644 --- a/include/linux/vermagic.h +++ b/include/linux/vermagic.h @@ -33,7 +33,6 @@ #define MODULE_VERMAGIC_MODVERSIONS "" #endif #ifdef RANDSTRUCT -#include #define MODULE_RANDSTRUCT "RANDSTRUCT_" RANDSTRUCT_HASHED_SEED #else #define MODULE_RANDSTRUCT --=20 2.34.1 From nobody Sat Feb 7 22:07:10 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0E5A816B3B7; Sat, 3 May 2025 18:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746297987; cv=none; b=MevFtRfGT6hrJoRnHPKEiJTnZcBJHcFXZF3AzvJUefLvvo7K9tV1XDZFHFUwn9i7u6JRjLwZ+P3DP721R3eQT1ZMAJkCL2iSC/6iEDTut+hwqVP7XyKuiB3f545BIXCOoILYVz4MnZozImItichc6S1VvsvMXZzXLVTsW2zERUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746297987; c=relaxed/simple; bh=+tpyu2HU8spYPzq1uf4EZ3SloA5fFEfjRjUkQSozF1w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fjbT93gRYUDiYUD+tPQ7YKhAkvdjUvpcYA6BjePGEYqkTlHAeKE6/9ZefTte7SlyZ/hEulsq86nnqYWBDM4Ujg4y7lIv/Dw/R8E+OdNO6MVOrJHs+GTprqfhP94LoHBrf+45kGtsPEWXhO1tDZRrKbNPoGeh8Ox7q9ozOBCNiso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nMyiXwu5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nMyiXwu5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C232C4CEEE; Sat, 3 May 2025 18:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746297986; bh=+tpyu2HU8spYPzq1uf4EZ3SloA5fFEfjRjUkQSozF1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nMyiXwu5nh0hGSlwFkUAtV2aMl6hkBcXj2nYBXc1EZfem3afnc7pOIoxQnegM+UtO AQIX/rgsH46feRTLVDVOdcfOdx7+h/S9GGAdOepB6Iak/4D6EZ7JHv1Ng8aNV3qeE/ fEROiBke/e8y7Ef8ZrA7MekJgwyKG3eJuSMnANJcB5+kaWC45hvJfC3IsQhqx1s81z aoTZHdunenePfUBV7z3DDmdXUK5vADwMNnESZDl3o7C16DkfgDUBxS0fTgZyN1LSym RL9viwL9YsPstWtVkqXz7gqeZoyz4nucQhW4q3HhvUpRAOXGQs5X6JGm0/uCgtog5E DyVYWt6phyH7Q== From: Kees Cook To: Masahiro Yamada Cc: Kees Cook , Justin Stitt , Nathan Chancellor , Nicolas Schier , Marco Elver , Andrey Konovalov , Andrey Ryabinin , linux-kbuild@vger.kernel.org, kasan-dev@googlegroups.com, linux-hardening@vger.kernel.org, Petr Pavlu , Sebastian Andrzej Siewior , Nick Desaulniers , Bill Wendling , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v3 3/3] integer-wrap: Force full rebuild when .scl file changes Date: Sat, 3 May 2025 11:46:20 -0700 Message-Id: <20250503184623.2572355-3-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250503184001.make.594-kees@kernel.org> References: <20250503184001.make.594-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2674; i=kees@kernel.org; h=from:subject; bh=+tpyu2HU8spYPzq1uf4EZ3SloA5fFEfjRjUkQSozF1w=; b=owGbwMvMwCVmps19z/KJym7G02pJDBliyft7n2QtDHVZzPzT7voxVRX9o38qkjOX/vRYvIpJI GFTQFxERykLgxgXg6yYIkuQnXuci8fb9nD3uYowc1iZQIYwcHEKwETSDRj+Z68L0rBx8nkQ1vFK /Z3w59knAyKm/q25XLPDJ3Wd/pPO+4wMr37EPn6zUEbQ81Oxn66L3YPZSxqD1p88miN63FK3vj+ FDQA= X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since the integer wrapping sanitizer's behavior depends on its associated .scl file, we must force a full rebuild if the file changes. If not, instrumentation may differ between targets based on when they were built. Generate a new header file, integer-wrap.h, any time the Clang .scl file changes. Include the header file in compiler-version.h when its associated feature name, INTEGER_WRAP, is defined. This will be picked up by fixdep and force rebuilds where needed. Signed-off-by: Kees Cook Acked-by: Justin Stitt Reviewed-by: Nicolas Schier --- Cc: Masahiro Yamada Cc: Justin Stitt Cc: Nathan Chancellor Cc: Nicolas Schier Cc: Marco Elver Cc: Andrey Konovalov Cc: Andrey Ryabinin Cc: Cc: Cc: --- include/linux/compiler-version.h | 3 +++ scripts/Makefile.ubsan | 1 + scripts/basic/Makefile | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/include/linux/compiler-version.h b/include/linux/compiler-vers= ion.h index 69b29b400ce2..187e749f9e79 100644 --- a/include/linux/compiler-version.h +++ b/include/linux/compiler-version.h @@ -19,3 +19,6 @@ #ifdef RANDSTRUCT #include #endif +#ifdef INTEGER_WRAP +#include +#endif diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan index 9e35198edbf0..653f7117819c 100644 --- a/scripts/Makefile.ubsan +++ b/scripts/Makefile.ubsan @@ -15,6 +15,7 @@ ubsan-cflags-$(CONFIG_UBSAN_TRAP) +=3D $(call cc-option,= -fsanitize-trap=3Dundefined export CFLAGS_UBSAN :=3D $(ubsan-cflags-y) =20 ubsan-integer-wrap-cflags-$(CONFIG_UBSAN_INTEGER_WRAP) +=3D \ + -DINTEGER_WRAP \ -fsanitize-undefined-ignore-overflow-pattern=3Dall \ -fsanitize=3Dsigned-integer-overflow \ -fsanitize=3Dunsigned-integer-overflow \ diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile index dd289a6725ac..fb8e2c38fbc7 100644 --- a/scripts/basic/Makefile +++ b/scripts/basic/Makefile @@ -14,3 +14,8 @@ cmd_create_randstruct_seed =3D \ $(obj)/randstruct.seed: $(gen-randstruct-seed) FORCE $(call if_changed,create_randstruct_seed) always-$(CONFIG_RANDSTRUCT) +=3D randstruct.seed + +# integer-wrap: if the .scl file changes, we need to do a full rebuild. +$(obj)/../../include/generated/integer-wrap.h: $(srctree)/scripts/integer-= wrap-ignore.scl FORCE + $(call if_changed,touch) +always-$(CONFIG_UBSAN_INTEGER_WRAP) +=3D ../../include/generated/integer-w= rap.h --=20 2.34.1