Skip to content

Commit

Permalink
kconfig.h: Include compiler types to avoid missed struct attributes
Browse files Browse the repository at this point in the history
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 <[email protected]>
Root-caused-by: Maciej S. Szmigiero <[email protected]>
Suggested-by: Linus Torvalds <[email protected]>
Tested-by: Maciej S. Szmigiero <[email protected]>
Fixes: 3859a27 ("randstruct: Mark various structs for randomization")
Signed-off-by: Kees Cook <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kees authored and torvalds committed Feb 22, 2018
1 parent b21ebf2 commit 28128c6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/linux/kconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
#include <linux/compiler_types.h>

#endif /* __LINUX_KCONFIG_H */

0 comments on commit 28128c6

Please sign in to comment.