Commit 28128c61 authored by Kees Cook's avatar Kees Cook Committed by Linus Torvalds

kconfig.h: Include compiler types to avoid missed struct attributes

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: default avatarPatrick McLean <chutzpah@gentoo.org>
Root-caused-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Tested-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
Fixes: 3859a271 ("randstruct: Mark various structs for randomization")
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b21ebf2f
...@@ -64,4 +64,7 @@ ...@@ -64,4 +64,7 @@
*/ */
#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option)) #define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))
/* Make sure we always have all types and struct attributes defined. */
#include <linux/compiler_types.h>
#endif /* __LINUX_KCONFIG_H */ #endif /* __LINUX_KCONFIG_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment