Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+9 -1
+9
include/linux/compiler-version.h
··· 23 23 #ifdef GCC_PLUGINS 24 24 #include <generated/gcc-plugins.h> 25 25 #endif 26 + 27 + /* 28 + * If the randstruct seed itself changes (whether for GCC plugins or 29 + * Clang), the entire tree needs to be rebuilt since the randomization of 30 + * structures may change between compilation units if not. 31 + */ 32 + #ifdef RANDSTRUCT 33 + #include <generated/randstruct_hash.h> 34 + #endif
-1
include/linux/vermagic.h
··· 33 33 #define MODULE_VERMAGIC_MODVERSIONS "" 34 34 #endif 35 35 #ifdef RANDSTRUCT 36 - #include <generated/randstruct_hash.h> 37 36 #define MODULE_RANDSTRUCT "RANDSTRUCT_" RANDSTRUCT_HASHED_SEED 38 37 #else 39 38 #define MODULE_RANDSTRUCT