linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: minyard@acm.org
To: linux-arm-kernel@lists.infradead.org
Cc: Stefan Wahren <stefan.wahren@i2se.com>,
	Corey Minyard <cminyard@mvista.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Andre Przywara <andre.przywara@arm.com>
Subject: [PATCH] arm64: Fix compile error with KVM and !HARDEN_BRANCH_PREDICTOR
Date: Wed, 27 Nov 2019 12:10:40 -0600	[thread overview]
Message-ID: <20191127181040.20012-1-minyard@acm.org> (raw)

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

             reply	other threads:[~2019-11-27 18:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 18:10 minyard [this message]
2019-11-28 17:20 ` [PATCH] arm64: Fix compile error with KVM and !HARDEN_BRANCH_PREDICTOR 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191127181040.20012-1-minyard@acm.org \
    --to=minyard@acm.org \
    --cc=andre.przywara@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=cminyard@mvista.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=stefan.wahren@i2se.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).