On Tue, Nov 06, 2018 at 11:20:19AM -0500, David Long wrote:
On 11/6/18 5:40 AM, Marc Zyngier wrote:
On Wed, 31 Oct 2018 13:56:58 +0000, David Long dave.long@linaro.org wrote:
From: Russell King rmk+kernel@armlinux.org.uk
Commit 10115105cb3aa17b5da1cb726ae8dd5f6854bd93 upstream.
Add firmware based hardening for cores that require more complex handling in firmware.
Signed-off-by: Russell King rmk+kernel@armlinux.org.uk Boot-tested-by: Tony Lindgren tony@atomide.com Reviewed-by: Tony Lindgren tony@atomide.com Reviewed-by: Marc Zyngier marc.zyngier@arm.com Signed-off-by: David A. Long dave.long@linaro.org
arch/arm/mm/proc-v7-bugs.c | 60 ++++++++++++++++++++++++++++++++++++++ arch/arm/mm/proc-v7.S | 21 +++++++++++++ 2 files changed, 81 insertions(+)
[...]
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 2d2e5ae85816..8fde9edb4a48 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S @@ -9,6 +9,7 @@
- This is the "shell" of the ARMv7 processor support.
*/ +#include <linux/arm-smccc.h> #include <linux/init.h> #include <linux/linkage.h> #include <asm/assembler.h> @@ -88,6 +89,26 @@ ENTRY(cpu_v7_dcache_clean_area) ret lr ENDPROC(cpu_v7_dcache_clean_area) +#ifdef CONFIG_ARM_PSCI
- .arch_extension sec
+ENTRY(cpu_v7_smc_switch_mm)
- stmfd sp!, {r0 - r3}
- movw r0, #:lower16:ARM_SMCCC_ARCH_WORKAROUND_1
- movt r0, #:upper16:ARM_SMCCC_ARCH_WORKAROUND_1
- smc #0
- ldmfd sp!, {r0 - r3}
- b cpu_v7_switch_mm
+ENDPROC(cpu_v7_smc_switch_mm)
- .arch_extension virt
+ENTRY(cpu_v7_hvc_switch_mm)
- stmfd sp!, {r0 - r3}
- movw r0, #:lower16:ARM_SMCCC_ARCH_WORKAROUND_1
- movt r0, #:upper16:ARM_SMCCC_ARCH_WORKAROUND_1
- hvc #0
- ldmfd sp!, {r0 - r3}
- b cpu_v7_switch_mm
+ENDPROC(cpu_v7_smc_switch_mm)
As pointed out by Ard a while ago [1], this breaks Thumb-2 kernels. Please keep this series on hold until this is fixed in mainline and you can cherry-pick the corresponding patch.
Thanks,
M.
Note that it looks like this problem is now in v4.14 stable too.
The good news is that Linus has just pulled the fix into mainline, so we can now poke Greg to pick it up for all stable kernels - but, as a result, we're going to get into a bit of a mess because it's going to require careful management of which stable kernels, and getting it applied by indirect reference along with _these_ patches.
I'm not sure if we've just made things easier or harder.