From f627ed70c11650611301435a20aa8abf9c8ececa Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Feb 2018 14:02:08 +0100 Subject: [PATCH] 4.14-stable patches added patches: arm64-mm-don-t-write-garbage-into-ttbr1_el1-register.patch kconfig.h-include-compiler-types-to-avoid-missed-struct-attributes.patch mips-boot-define-__assembly__-for-its.s-build.patch --- ...rite-garbage-into-ttbr1_el1-register.patch | 36 ++++++++++++++++ ...es-to-avoid-missed-struct-attributes.patch | 41 +++++++++++++++++++ ...-define-__assembly__-for-its.s-build.patch | 41 +++++++++++++++++++ queue-4.14/series | 3 ++ 4 files changed, 121 insertions(+) create mode 100644 queue-4.14/arm64-mm-don-t-write-garbage-into-ttbr1_el1-register.patch create mode 100644 queue-4.14/kconfig.h-include-compiler-types-to-avoid-missed-struct-attributes.patch create mode 100644 queue-4.14/mips-boot-define-__assembly__-for-its.s-build.patch diff --git a/queue-4.14/arm64-mm-don-t-write-garbage-into-ttbr1_el1-register.patch b/queue-4.14/arm64-mm-don-t-write-garbage-into-ttbr1_el1-register.patch new file mode 100644 index 00000000000..2d994f08ac2 --- /dev/null +++ b/queue-4.14/arm64-mm-don-t-write-garbage-into-ttbr1_el1-register.patch @@ -0,0 +1,36 @@ +From ard.biesheuvel@linaro.org Mon Feb 26 13:53:22 2018 +From: Ard Biesheuvel +Date: Fri, 23 Feb 2018 18:29:02 +0000 +Subject: arm64: mm: don't write garbage into TTBR1_EL1 register +To: linux-arm-kernel@lists.infradead.org +Cc: catalin.marinas@arm.com, will.deacon@arm.com, marc.zyngier@arm.com, mark.rutland@arm.com, nicolas.dechesne@linaro.org, gregkh@linuxfoundation.org, Ard Biesheuvel +Message-ID: <20180223182902.24873-1-ard.biesheuvel@linaro.org> + +From: Ard Biesheuvel + +Stable backport commit 173358a49173 ("arm64: kpti: Add ->enable callback +to remap swapper using nG mappings") of upstream commit f992b4dfd58b did +not survive the backporting process unscathed, and ends up writing garbage +into the TTBR1_EL1 register, rather than pointing it to the zero page to +disable translations. Fix that. + +Cc: #v4.14 +Reported-by: Nicolas Dechesne +Signed-off-by: Ard Biesheuvel +Acked-by: Will Deacon +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/mm/proc.S | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/mm/proc.S ++++ b/arch/arm64/mm/proc.S +@@ -155,7 +155,7 @@ ENDPROC(cpu_do_switch_mm) + + .macro __idmap_cpu_set_reserved_ttbr1, tmp1, tmp2 + adrp \tmp1, empty_zero_page +- msr ttbr1_el1, \tmp2 ++ msr ttbr1_el1, \tmp1 + isb + tlbi vmalle1 + dsb nsh diff --git a/queue-4.14/kconfig.h-include-compiler-types-to-avoid-missed-struct-attributes.patch b/queue-4.14/kconfig.h-include-compiler-types-to-avoid-missed-struct-attributes.patch new file mode 100644 index 00000000000..49a07c96478 --- /dev/null +++ b/queue-4.14/kconfig.h-include-compiler-types-to-avoid-missed-struct-attributes.patch @@ -0,0 +1,41 @@ +From 28128c61e08eaeced9cc8ec0e6b5d677b5b94690 Mon Sep 17 00:00:00 2001 +From: Kees Cook +Date: Thu, 22 Feb 2018 09:41:40 -0800 +Subject: kconfig.h: Include compiler types to avoid missed struct attributes + +From: Kees Cook + +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 +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 +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/kconfig.h | 3 +++ + 1 file changed, 3 insertions(+) + +--- 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 */ diff --git a/queue-4.14/mips-boot-define-__assembly__-for-its.s-build.patch b/queue-4.14/mips-boot-define-__assembly__-for-its.s-build.patch new file mode 100644 index 00000000000..1408dcdfae6 --- /dev/null +++ b/queue-4.14/mips-boot-define-__assembly__-for-its.s-build.patch @@ -0,0 +1,41 @@ +From 0f9da844d87796ac31b04e81ee95e155e9043132 Mon Sep 17 00:00:00 2001 +From: Kees Cook +Date: Thu, 22 Feb 2018 16:59:26 -0800 +Subject: MIPS: boot: Define __ASSEMBLY__ for its.S build + +From: Kees Cook + +commit 0f9da844d87796ac31b04e81ee95e155e9043132 upstream. + +The MIPS %.its.S compiler command did not define __ASSEMBLY__, which meant +when compiler_types.h was added to kconfig.h, unexpected things appeared +(e.g. struct declarations) which should not have been present. As done in +the general %.S compiler command, __ASSEMBLY__ is now included here too. + +The failure was: + + Error: arch/mips/boot/vmlinux.gz.its:201.1-2 syntax error + FATAL ERROR: Unable to parse input tree + /usr/bin/mkimage: Can't read arch/mips/boot/vmlinux.gz.itb.tmp: Invalid argument + /usr/bin/mkimage Can't add hashes to FIT blob + +Reported-by: kbuild test robot +Fixes: 28128c61e08e ("kconfig.h: Include compiler types to avoid missed struct attributes") +Signed-off-by: Kees Cook +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/boot/Makefile | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/mips/boot/Makefile ++++ b/arch/mips/boot/Makefile +@@ -126,6 +126,7 @@ $(obj)/vmlinux.its.S: $(addprefix $(srct + + quiet_cmd_cpp_its_S = ITS $@ + cmd_cpp_its_S = $(CPP) $(cpp_flags) -P -C -o $@ $< \ ++ -D__ASSEMBLY__ \ + -DKERNEL_NAME="\"Linux $(KERNELRELEASE)\"" \ + -DVMLINUX_BINARY="\"$(3)\"" \ + -DVMLINUX_COMPRESSION="\"$(2)\"" \ diff --git a/queue-4.14/series b/queue-4.14/series index f4e4ea61f83..d0c5fd2acf6 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -1 +1,4 @@ netfilter-drop-outermost-socket-lock-in-getsockopt.patch +arm64-mm-don-t-write-garbage-into-ttbr1_el1-register.patch +kconfig.h-include-compiler-types-to-avoid-missed-struct-attributes.patch +mips-boot-define-__assembly__-for-its.s-build.patch -- 2.47.3