From accddec6231c97fc37e52658d3e9c8bc22b41613 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 30 Jan 2022 13:56:33 +0100 Subject: [PATCH] 4.14-stable patches added patches: lkdtm-fix-content-of-section-containing-lkdtm_rodata_do_nothing.patch powerpc-32-fix-boot-failure-with-gcc-latent-entropy-plugin.patch --- ...n-containing-lkdtm_rodata_do_nothing.patch | 55 +++++++++++++++++++ ...ilure-with-gcc-latent-entropy-plugin.patch | 54 ++++++++++++++++++ queue-4.14/series | 2 + 3 files changed, 111 insertions(+) create mode 100644 queue-4.14/lkdtm-fix-content-of-section-containing-lkdtm_rodata_do_nothing.patch create mode 100644 queue-4.14/powerpc-32-fix-boot-failure-with-gcc-latent-entropy-plugin.patch diff --git a/queue-4.14/lkdtm-fix-content-of-section-containing-lkdtm_rodata_do_nothing.patch b/queue-4.14/lkdtm-fix-content-of-section-containing-lkdtm_rodata_do_nothing.patch new file mode 100644 index 00000000000..5a14a208720 --- /dev/null +++ b/queue-4.14/lkdtm-fix-content-of-section-containing-lkdtm_rodata_do_nothing.patch @@ -0,0 +1,55 @@ +From bc93a22a19eb2b68a16ecf04cdf4b2ed65aaf398 Mon Sep 17 00:00:00 2001 +From: Christophe Leroy +Date: Fri, 8 Oct 2021 18:58:40 +0200 +Subject: lkdtm: Fix content of section containing lkdtm_rodata_do_nothing() + +From: Christophe Leroy + +commit bc93a22a19eb2b68a16ecf04cdf4b2ed65aaf398 upstream. + +On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA +test leads to "Illegal instruction" failure. + +Looking at the content of rodata_objcopy.o, we see that the +function content zeroes only: + + Disassembly of section .rodata: + + 0000000000000000 <.lkdtm_rodata_do_nothing>: + 0: 00 00 00 00 .long 0x0 + +Add the contents flag in order to keep the content of the section +while renaming it. + + Disassembly of section .rodata: + + 0000000000000000 <.lkdtm_rodata_do_nothing>: + 0: 4e 80 00 20 blr + +Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy") +Cc: stable@vger.kernel.org +Cc: Kees Cook +Cc: Arnd Bergmann +Cc: Greg Kroah-Hartman +Cc: Nick Desaulniers +Cc: Nathan Chancellor +Signed-off-by: Christophe Leroy +Reviewed-by: Nick Desaulniers +Signed-off-by: Kees Cook +Link: https://lore.kernel.org/r/8900731fbc05fb8b0de18af7133a8fc07c3c53a1.1633712176.git.christophe.leroy@csgroup.eu +Signed-off-by: Greg Kroah-Hartman +--- + drivers/misc/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/misc/Makefile ++++ b/drivers/misc/Makefile +@@ -69,7 +69,7 @@ KCOV_INSTRUMENT_lkdtm_rodata.o := n + + OBJCOPYFLAGS := + OBJCOPYFLAGS_lkdtm_rodata_objcopy.o := \ +- --rename-section .text=.rodata,alloc,readonly,load ++ --rename-section .text=.rodata,alloc,readonly,load,contents + targets += lkdtm_rodata.o lkdtm_rodata_objcopy.o + $(obj)/lkdtm_rodata_objcopy.o: $(obj)/lkdtm_rodata.o FORCE + $(call if_changed,objcopy) diff --git a/queue-4.14/powerpc-32-fix-boot-failure-with-gcc-latent-entropy-plugin.patch b/queue-4.14/powerpc-32-fix-boot-failure-with-gcc-latent-entropy-plugin.patch new file mode 100644 index 00000000000..2c7666deaf1 --- /dev/null +++ b/queue-4.14/powerpc-32-fix-boot-failure-with-gcc-latent-entropy-plugin.patch @@ -0,0 +1,54 @@ +From bba496656a73fc1d1330b49c7f82843836e9feb1 Mon Sep 17 00:00:00 2001 +From: Christophe Leroy +Date: Wed, 22 Dec 2021 13:07:31 +0000 +Subject: powerpc/32: Fix boot failure with GCC latent entropy plugin + +From: Christophe Leroy + +commit bba496656a73fc1d1330b49c7f82843836e9feb1 upstream. + +Boot fails with GCC latent entropy plugin enabled. + +This is due to early boot functions trying to access 'latent_entropy' +global data while the kernel is not relocated at its final +destination yet. + +As there is no way to tell GCC to use PTRRELOC() to access it, +disable latent entropy plugin in early_32.o and feature-fixups.o and +code-patching.o + +Fixes: 38addce8b600 ("gcc-plugins: Add latent_entropy plugin") +Cc: stable@vger.kernel.org # v4.9+ +Reported-by: Erhard Furtner +Signed-off-by: Christophe Leroy +Signed-off-by: Michael Ellerman +Link: https://bugzilla.kernel.org/show_bug.cgi?id=215217 +Link: https://lore.kernel.org/r/2bac55483b8daf5b1caa163a45fa5f9cdbe18be4.1640178426.git.christophe.leroy@csgroup.eu +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/kernel/Makefile | 1 + + arch/powerpc/lib/Makefile | 3 +++ + 2 files changed, 4 insertions(+) + +--- a/arch/powerpc/kernel/Makefile ++++ b/arch/powerpc/kernel/Makefile +@@ -15,6 +15,7 @@ CFLAGS_prom_init.o += -fPIC + CFLAGS_btext.o += -fPIC + endif + ++CFLAGS_setup_32.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) + CFLAGS_cputable.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) + CFLAGS_prom_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) + CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) +--- a/arch/powerpc/lib/Makefile ++++ b/arch/powerpc/lib/Makefile +@@ -10,6 +10,9 @@ ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_ + CFLAGS_REMOVE_code-patching.o = $(CC_FLAGS_FTRACE) + CFLAGS_REMOVE_feature-fixups.o = $(CC_FLAGS_FTRACE) + ++CFLAGS_code-patching.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) ++CFLAGS_feature-fixups.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) ++ + obj-y += string.o alloc.o code-patching.o feature-fixups.o + + obj-$(CONFIG_PPC32) += div64.o copy_32.o crtsavres.o diff --git a/queue-4.14/series b/queue-4.14/series index c85f6f8fbdd..0643e79c510 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -14,3 +14,5 @@ usb-gadget-f_sourcesink-fix-isoc-transfer-for-usb_speed_super_plus.patch usb-core-fix-hang-in-usb_kill_urb-by-adding-memory-barriers.patch usb-typec-tcpm-do-not-disconnect-while-receiving-vbus-off.patch net-sfp-ignore-disabled-sfp-node.patch +powerpc-32-fix-boot-failure-with-gcc-latent-entropy-plugin.patch +lkdtm-fix-content-of-section-containing-lkdtm_rodata_do_nothing.patch -- 2.47.2