From: Greg Kroah-Hartman Date: Tue, 17 Sep 2019 08:00:20 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v4.14.145~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac399366d0d1dcc8d2837fff1c1da76bb4792f3a;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: mips-vdso-prevent-use-of-smp_processor_id.patch mips-vdso-use-same-m-float-cflag-as-the-kernel-proper.patch --- diff --git a/queue-4.9/mips-vdso-prevent-use-of-smp_processor_id.patch b/queue-4.9/mips-vdso-prevent-use-of-smp_processor_id.patch new file mode 100644 index 00000000000..841bb97cec8 --- /dev/null +++ b/queue-4.9/mips-vdso-prevent-use-of-smp_processor_id.patch @@ -0,0 +1,65 @@ +From 351fdddd366245c0fb4636f32edfb4198c8d6b8c Mon Sep 17 00:00:00 2001 +From: Paul Burton +Date: Tue, 12 Dec 2017 09:57:47 +0000 +Subject: MIPS: VDSO: Prevent use of smp_processor_id() + +From: Paul Burton + +commit 351fdddd366245c0fb4636f32edfb4198c8d6b8c upstream. + +VDSO code should not be using smp_processor_id(), since it is executed +in user mode. +Introduce a VDSO-specific path which will cause a compile-time +or link-time error (depending upon support for __compiletime_error) if +the VDSO ever incorrectly attempts to use smp_processor_id(). + +[Matt Redfearn : Move before change to +smp_processor_id in series] + +Signed-off-by: Paul Burton +Signed-off-by: Matt Redfearn +Patchwork: https://patchwork.linux-mips.org/patch/17932/ +Cc: Ralf Baechle +Cc: James Hogan +Cc: linux-mips@linux-mips.org +Cc: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/include/asm/smp.h | 12 +++++++++++- + arch/mips/vdso/Makefile | 3 ++- + 2 files changed, 13 insertions(+), 2 deletions(-) + +--- a/arch/mips/include/asm/smp.h ++++ b/arch/mips/include/asm/smp.h +@@ -25,7 +25,17 @@ extern cpumask_t cpu_sibling_map[]; + extern cpumask_t cpu_core_map[]; + extern cpumask_t cpu_foreign_map[]; + +-#define raw_smp_processor_id() (current_thread_info()->cpu) ++static inline int raw_smp_processor_id(void) ++{ ++#if defined(__VDSO__) ++ extern int vdso_smp_processor_id(void) ++ __compiletime_error("VDSO should not call smp_processor_id()"); ++ return vdso_smp_processor_id(); ++#else ++ return current_thread_info()->cpu; ++#endif ++} ++#define raw_smp_processor_id raw_smp_processor_id + + /* Map from cpu id to sequential logical cpu number. This will only + not be idempotent when cpus failed to come on-line. */ +--- a/arch/mips/vdso/Makefile ++++ b/arch/mips/vdso/Makefile +@@ -6,7 +6,8 @@ ccflags-vdso := \ + $(filter -I%,$(KBUILD_CFLAGS)) \ + $(filter -E%,$(KBUILD_CFLAGS)) \ + $(filter -mmicromips,$(KBUILD_CFLAGS)) \ +- $(filter -march=%,$(KBUILD_CFLAGS)) ++ $(filter -march=%,$(KBUILD_CFLAGS)) \ ++ -D__VDSO__ + cflags-vdso := $(ccflags-vdso) \ + $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \ + -O2 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \ diff --git a/queue-4.9/mips-vdso-use-same-m-float-cflag-as-the-kernel-proper.patch b/queue-4.9/mips-vdso-use-same-m-float-cflag-as-the-kernel-proper.patch new file mode 100644 index 00000000000..167b6e0a290 --- /dev/null +++ b/queue-4.9/mips-vdso-use-same-m-float-cflag-as-the-kernel-proper.patch @@ -0,0 +1,63 @@ +From 0648e50e548d881d025b9419a1a168753c8e2bf7 Mon Sep 17 00:00:00 2001 +From: Paul Burton +Date: Mon, 28 Jan 2019 22:21:17 +0000 +Subject: MIPS: VDSO: Use same -m%-float cflag as the kernel proper + +From: Paul Burton + +commit 0648e50e548d881d025b9419a1a168753c8e2bf7 upstream. + +The MIPS VDSO build currently doesn't provide the -msoft-float flag to +the compiler as the kernel proper does. This results in an attempt to +use the compiler's default floating point configuration, which can be +problematic in cases where this is incompatible with the target CPU's +-march= flag. For example decstation_defconfig fails to build using +toolchains in which gcc was configured --with-fp-32=xx with the +following error: + + LDS arch/mips/vdso/vdso.lds + cc1: error: '-march=r3000' requires '-mfp32' + make[2]: *** [scripts/Makefile.build:379: arch/mips/vdso/vdso.lds] Error 1 + +The kernel proper avoids this error because we build with the +-msoft-float compiler flag, rather than using the compiler's default. +Pass this flag through to the VDSO build so that it too becomes agnostic +to the toolchain's floating point configuration. + +Note that this is filtered out from KBUILD_CFLAGS rather than simply +always using -msoft-float such that if we switch the kernel to use +-mno-float in the future the VDSO will automatically inherit the change. + +The VDSO doesn't actually include any floating point code, and its +.MIPS.abiflags section is already manually generated to specify that +it's compatible with any floating point ABI. As such this change should +have no effect on the resulting VDSO, apart from fixing the build +failure for affected toolchains. + +Signed-off-by: Paul Burton +Reported-by: Kevin Hilman +Reported-by: Guenter Roeck +Tested-by: Kevin Hilman +References: https://lore.kernel.org/linux-mips/1477843551-21813-1-git-send-email-linux@roeck-us.net/ +References: https://kernelci.org/build/id/5c4e4ae059b5142a249ad004/logs/ +Fixes: ebb5e78cc634 ("MIPS: Initial implementation of a VDSO") +Cc: Maciej W. Rozycki +Cc: linux-mips@vger.kernel.org +Cc: stable@vger.kernel.org # v4.4+ +Cc: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/vdso/Makefile | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/mips/vdso/Makefile ++++ b/arch/mips/vdso/Makefile +@@ -7,6 +7,7 @@ ccflags-vdso := \ + $(filter -E%,$(KBUILD_CFLAGS)) \ + $(filter -mmicromips,$(KBUILD_CFLAGS)) \ + $(filter -march=%,$(KBUILD_CFLAGS)) \ ++ $(filter -m%-float,$(KBUILD_CFLAGS)) \ + -D__VDSO__ + cflags-vdso := $(ccflags-vdso) \ + $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \ diff --git a/queue-4.9/series b/queue-4.9/series index d38847036ea..7034a2ae5bf 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -18,3 +18,5 @@ genirq-prevent-null-pointer-dereference-in-resend_irqs.patch kvm-s390-do-not-leak-kernel-stack-data-in-the-kvm_s390_interrupt-ioctl.patch kvm-x86-work-around-leak-of-uninitialized-stack-contents.patch kvm-nvmx-handle-page-fault-in-vmread.patch +mips-vdso-prevent-use-of-smp_processor_id.patch +mips-vdso-use-same-m-float-cflag-as-the-kernel-proper.patch