All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] kconfig.h: Include compiler types to avoid missed struct attributes
@ 2018-02-22  0:28 Kees Cook
  2018-02-22 15:56 ` Maciej S. Szmigiero
       [not found] ` <201802230613.8bqOOUnw%fengguang.wu@intel.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Kees Cook @ 2018-02-22  0:28 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Patrick McLean, Maciej S. Szmigiero, linux-kernel

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 <chutzpah@gentoo.org>
Root-caused-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Fixes: 3859a271a003 ("randstruct: Mark various structs for randomization")
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Updated Maciej's tag.
---
 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
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -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 */
-- 
2.7.4


-- 
Kees Cook
Pixel Security

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-23  0:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22  0:28 [PATCH v2] kconfig.h: Include compiler types to avoid missed struct attributes Kees Cook
2018-02-22 15:56 ` Maciej S. Szmigiero
     [not found] ` <201802230613.8bqOOUnw%fengguang.wu@intel.com>
2018-02-23  0:03   ` Kees Cook
2018-02-23  0:19     ` Kees Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.