From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933547AbeBVRlo (ORCPT ); Thu, 22 Feb 2018 12:41:44 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:38031 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933427AbeBVRln (ORCPT ); Thu, 22 Feb 2018 12:41:43 -0500 X-Google-Smtp-Source: AH8x225FmOG7YG1wLdDGBoSbMxal/FnFoXQ5bQlcQOFukJ9QmHU8qHAWJaR4H43K09A5okHlM/uYRQ== Date: Thu, 22 Feb 2018 09:41:40 -0800 From: Kees Cook To: Linus Torvalds Cc: Patrick McLean , "Maciej S. Szmigiero" , linux-kernel@vger.kernel.org Subject: [PATCH v3] kconfig.h: Include compiler types to avoid missed struct attributes Message-ID: <20180222174140.GA3154@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Root-caused-by: Maciej S. Szmigiero Suggested-by: Linus Torvalds Tested-by: Maciej S. Szmigiero Fixes: 3859a271a003 ("randstruct: Mark various structs for randomization") Signed-off-by: Kees Cook --- 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 --- 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 + #endif /* __LINUX_KCONFIG_H */ -- 2.7.4 -- Kees Cook Pixel Security