linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: Fix compile error with KVM and !HARDEN_BRANCH_PREDICTOR
@ 2019-11-27 18:10 minyard
  2019-11-28 17:20 ` Ard Biesheuvel
  0 siblings, 1 reply; 9+ messages in thread
From: minyard @ 2019-11-27 18:10 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Stefan Wahren, Corey Minyard, Ard Biesheuvel, Catalin Marinas,
	Will Deacon, Andre Przywara

From: Corey Minyard <cminyard@mvista.com>

When compiling with KVM enabled and without HARDEN_BRANCH_PREDICTOR,
the following compile error happens:

arch/arm64/kernel/cpu_errata.c:92:23:
error: '__bp_harden_hyp_vecs_start' undeclared (first use in this function);
did you mean 'hyp_vecs_start'?
  void *dst = lm_alias(__bp_harden_hyp_vecs_start + slot * SZ_2K);

Some ifdefs were removed by 3e91f3eacc91d9 "arm64: Always enable
spectre-v2 vulnerability detection" for CONFIG_HARDEN_BRANCH_PREDICTOR,
but __bp_harden_hyp_vecs_start is only defined if that config is
enabled.

Add CONFIG_HARDEN_BRANCH_PREDICTOR to the #if that has CONFIG_KVM,
It looks like you need both of those for that code to be valid.

Fixes: 3e91f3eacc91d9 "arm64: Always enable spectre-v2 vulnerability detection"
Cc: Andre Przywara <andre.przywara@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
This is for 4.14, I'm not sure if it is needed for other kernels.

It is not needed in master because a new config item was added,
CONFIG_KVM_INDIRECT_VECTORS, that depends on KVM and
HARDEN_BRANCH_PREDICTOR being configured.  I looked at pulling the
patches that add the required changes, and they make a lot of
changes.  This change is the simple fix, but I'm not sure if we want to
pull all those other changes into 4.14 and whatever other kernels
are required.

 arch/arm64/kernel/cpu_errata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
index 7d15f4cb6393..e565ec5e072f 100644
--- a/arch/arm64/kernel/cpu_errata.c
+++ b/arch/arm64/kernel/cpu_errata.c
@@ -82,7 +82,7 @@ cpu_enable_trap_ctr_access(const struct arm64_cpu_capabilities *__unused)
 
 DEFINE_PER_CPU_READ_MOSTLY(struct bp_hardening_data, bp_hardening_data);
 
-#ifdef CONFIG_KVM
+#if defined(CONFIG_KVM) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR)
 extern char __smccc_workaround_1_smc_start[];
 extern char __smccc_workaround_1_smc_end[];
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-12-04 15:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 18:10 [PATCH] arm64: Fix compile error with KVM and !HARDEN_BRANCH_PREDICTOR minyard
2019-11-28 17:20 ` Ard Biesheuvel
2019-11-29  7:21   ` Marc Zyngier
2019-11-29  7:25     ` Ard Biesheuvel
2019-11-29  9:04       ` Marc Zyngier
2019-12-03 18:35         ` Ard Biesheuvel
2019-12-03 18:45           ` Marc Zyngier
2019-12-03 19:16             ` Corey Minyard
2019-12-04 15:51               ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).