From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f194.google.com ([209.85.192.194]:44090 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751283AbeBVXec (ORCPT ); Thu, 22 Feb 2018 18:34:32 -0500 Received: by mail-pf0-f194.google.com with SMTP id 17so2730314pfw.11 for ; Thu, 22 Feb 2018 15:34:32 -0800 (PST) Date: Thu, 22 Feb 2018 15:34:29 -0800 From: Kees Cook To: Greg Kroah-Hartman Cc: stable@vger.kernel.org, Patrick McLean , "Maciej S. Szmigiero" Subject: [PATCH 4.15,4.14] path.h: Include compiler types to avoid missed struct attributes Message-ID: <20180222233429.GA43713@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: stable-owner@vger.kernel.org List-ID: commit 28128c61e08eaeced9cc8ec0e6b5d677b5b94690 upstream. 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 path.h. 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 Signed-off-by: Linus Torvalds [kees: Adjusted to just path.h for -stable, as this is a smaller change] Signed-off-by: Kees Cook --- This is a much more narrow fix for the issue. I adjusted the commit subject and body, but still reference the "full" upstream commit. Is this the best way to handle this? --- include/linux/path.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/path.h b/include/linux/path.h index 81e65a5be7ce..74a59d190a3c 100644 --- a/include/linux/path.h +++ b/include/linux/path.h @@ -2,6 +2,8 @@ #ifndef _LINUX_PATH_H #define _LINUX_PATH_H +#include + struct dentry; struct vfsmount; -- 2.7.4 -- Kees Cook Pixel Security