diff options
author | Kees Cook <kees@kernel.org> | 2025-05-03 11:46:19 -0700 |
---|---|---|
committer | Kees Cook <kees@kernel.org> | 2025-05-08 09:42:06 -0700 |
commit | 056000c471ea41db56de58f71b9fe727d6e68b9b (patch) | |
tree | e59dea397c3f169770f592d45d2aee7b0a8393e9 /include/linux/compiler-version.h | |
parent | 0cecd37daef3d57e6656c0023978d5ec2d7409c1 (diff) |
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.
Link: https://lore.kernel.org/r/20250503184623.2572355-2-kees@kernel.org
Reviewed-by: Nicolas Schier <n.schier@avm.de>
Tested-by: Nicolas Schier <n.schier@avm.de>
Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'include/linux/compiler-version.h')
-rw-r--r-- | include/linux/compiler-version.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/compiler-version.h b/include/linux/compiler-version.h index 5dba398a9412..4b9d39b37650 100644 --- a/include/linux/compiler-version.h +++ b/include/linux/compiler-version.h @@ -23,3 +23,12 @@ #ifdef GCC_PLUGINS #include <generated/gcc-plugins.h> #endif + +/* + * If the randstruct seed itself changes (whether for GCC plugins or + * Clang), the entire tree needs to be rebuilt since the randomization of + * structures may change between compilation units if not. + */ +#ifdef RANDSTRUCT +#include <generated/randstruct_hash.h> +#endif |