path.h: Include compiler types to avoid missed struct attributes
PATCH 1/1 path.h: Include compiler types to avoid missed struct attributes
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.
---
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(+)
include/linux/path.h +2 -0
@@ -2,6 +2,8 @@#ifndef _LINUX_PATH_H#define _LINUX_PATH_H +#include <linux/compiler_types.h> +struct dentry ;struct vfsmount ;
Signature · 6 lines
2.7.4 -- Kees Cook Pixel Security
Greg Kroah-Hartman
maintainerQuoted 18 lines · Kees Cook
commit
28128c61e08eaeced9cc8ec0e6b5d677b5b94690upstream.The header files for some structures could get included in such a way that struct attributes (specifically
__randomize_layoutfrompath.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.hheader is included inpath.h.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 3859a271a003 ("randstruct: Mark various structs for randomization")Signed-off-by Kees Cook <[email protected]>Signed-off-by Linus Torvalds <[email protected]>[kees: Adjusted to just path.h for -stable, as this is a smaller change]Signed-off-by Kees Cook <[email protected]>
Quoted 4 lines
---
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?
What's wrong with just taking the original upstream commit here? It's only 2 lines, in kconfig.h instead of path.h. What is the reason this has to be in path.h for 4.14.y and 4.15.y?
thanks,
greg k-h
Quoted 24 lines · Greg Kroah-Hartman
Quoted 18 lines · Kees Cook
commit
28128c61e08eaeced9cc8ec0e6b5d677b5b94690upstream.The header files for some structures could get included in such a way that struct attributes (specifically
__randomize_layoutfrompath.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.hheader is included inpath.h.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 3859a271a003 ("randstruct: Mark various structs for randomization")Signed-off-by Kees Cook <[email protected]>Signed-off-by Linus Torvalds <[email protected]>[kees: Adjusted to just path.h for -stable, as this is a smaller change]Signed-off-by Kees Cook <[email protected]>Quoted 4 lines
---
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?
Quoted 3 lines
What's wrong with just taking the original upstream commit here? It's only 2 lines, in
kconfig.hinstead ofpath.h. What is the reason this has to be inpath.hfor 4.14.y and 4.15.y?
I was (rightly) worried about unexpected build changes. If you'd rather stick to upstream, we can do it. It'll just need at least one fix so far:
Do you want me to just send those two?
-Kees
Signature · 2 lines
Kees Cook Pixel Security
Greg Kroah-Hartman
maintainerQuoted 30 lines · Kees Cook
Quoted 24 lines · Greg Kroah-Hartman
Quoted 18 lines · Kees Cook
commit
28128c61e08eaeced9cc8ec0e6b5d677b5b94690upstream.The header files for some structures could get included in such a way that struct attributes (specifically
__randomize_layoutfrompath.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.hheader is included inpath.h.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 3859a271a003 ("randstruct: Mark various structs for randomization")Signed-off-by Kees Cook <[email protected]>Signed-off-by Linus Torvalds <[email protected]>[kees: Adjusted to just path.h for -stable, as this is a smaller change]Signed-off-by Kees Cook <[email protected]>Quoted 4 lines
---
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?Quoted 3 lines
What's wrong with just taking the original upstream commit here? It's only 2 lines, in
kconfig.hinstead ofpath.h. What is the reason this has to be inpath.hfor 4.14.y and 4.15.y?
Quoted 7 lines
I was (rightly) worried about unexpected build changes. If you'd rather stick to upstream, we can do it. It'll just need at least one fix so far:
Do you want me to just send those two?
I can just take the git commits as-is, right? If not, a backport is always welcome :)
thanks,
greg k-h
Quoted 4 lines · Greg Kroah-Hartman
I can just take the git commits as-is, right? If not, a backport is always welcome :)
As it turns out, yes, the renaming of compiler_types.h was backported too.
In this case, please queue for 4.14 and 4.15, these patches:
28128c61e08eaeced9cc8ec0e6b5d677b5b946900f9da844d87796ac31b04e81ee95e155e9043132
Thanks!
-Kees
Signature · 2 lines
Kees Cook Pixel Security
Greg Kroah-Hartman
maintainerQuoted 7 lines · Kees Cook
Quoted 4 lines · Greg Kroah-Hartman
I can just take the git commits as-is, right? If not, a backport is always welcome :)
Quoted 6 lines
As it turns out, yes, the renaming of
compiler_types.hwas backported too.In this case, please queue for 4.14 and 4.15, these patches:
28128c61e08eaeced9cc8ec0e6b5d677b5b946900f9da844d87796ac31b04e81ee95e155e9043132
Now applied, thanks.
greg k-h