The header files for some structures could get included in such a way
that struct attributes (specifically __randomize_layout from path.h) would
be parsed as variable names instead of attributes. This could lead to
some instances of a structure being unrandomized, causing nasty GPFs, etc.
This patch makes sure the compiler_types.h header is included in
kconfig.h so that we've always got types and struct attributes defined,
since kconfig.h is included from the compiler command line.
Reported-by: Patrick McLean <chutz...@gentoo.org>
Root-caused-by: Maciej S. Szmigiero <m...@maciej.szmigiero.name>
Suggested-by: Linus Torvalds <torva...@linux-foundation.org>
Tested-by: Maciej S. Szmigiero <m...@maciej.szmigiero.name>
Fixes: 3859a271a003 ("randstruct: Mark various structs for randomization")
Signed-off-by: Kees Cook <keesc...@chromium.org>
Updated to include Tested-by. Linus, this looks ready to go. I'll send
-stable patches that just fix up path.h.
include/linux/kconfig.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index fec5076eda91..c5fd4ee776ba 100644
@@ -64,4 +64,7 @@
#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))
+/* Make sure we always have all types and struct attributes defined. */
#endif /* __LINUX_KCONFIG_H */