[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250503184623.2572355-2-kees@kernel.org>
Date: Sat, 3 May 2025 11:46:19 -0700
From: Kees Cook <kees@...nel.org>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: Kees Cook <kees@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas.schier@...ux.dev>,
Petr Pavlu <petr.pavlu@...e.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
linux-kbuild@...r.kernel.org,
Justin Stitt <justinstitt@...gle.com>,
Marco Elver <elver@...gle.com>,
Andrey Konovalov <andreyknvl@...il.com>,
Andrey Ryabinin <ryabinin.a.a@...il.com>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>,
linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org,
kasan-dev@...glegroups.com,
llvm@...ts.linux.dev
Subject: [PATCH v3 2/3] randstruct: Force full rebuild when seed changes
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 <kees@...nel.org>
---
Cc: Masahiro Yamada <masahiroy@...nel.org>
Cc: Nathan Chancellor <nathan@...nel.org>
Cc: Nicolas Schier <nicolas.schier@...ux.dev>
Cc: Petr Pavlu <petr.pavlu@...e.com>
Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: <linux-kbuild@...r.kernel.org>
---
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-version.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 <generated/gcc-plugins.h>
#endif
+#ifdef RANDSTRUCT
+#include <generated/randstruct_hash.h>
+#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 <generated/randstruct_hash.h>
#define MODULE_RANDSTRUCT "RANDSTRUCT_" RANDSTRUCT_HASHED_SEED
#else
#define MODULE_RANDSTRUCT
--
2.34.1
Powered by blists - more mailing lists