From: Will Deacon <will@kernel.org>
To: kvmarm@lists.cs.columbia.edu
Cc: catalin.marinas@arm.com, kernel-team@android.com,
Will Deacon <will@kernel.org>, Marc Zyngier <maz@kernel.org>
Subject: [PATCH v2 4/9] KVM: arm64: Make BP hardening globals static instead
Date: Mon, 9 Nov 2020 21:47:21 +0000 [thread overview]
Message-ID: <20201109214726.15276-5-will@kernel.org> (raw)
In-Reply-To: <20201109214726.15276-1-will@kernel.org>
Branch predictor hardening of the hyp vectors is partially driven by a
couple of global variables ('__kvm_bp_vect_base' and
'__kvm_harden_el2_vector_slot'). However, these are only used within a
single compilation unit, so internalise them there instead.
Cc: Marc Zyngier <maz@kernel.org>
Cc: Quentin Perret <qperret@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
---
arch/arm64/include/asm/kvm_mmu.h | 3 ---
arch/arm64/kvm/arm.c | 8 ++++++++
arch/arm64/kvm/va_layout.c | 3 ---
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
index 23182e7d9413..db721be0df62 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -208,9 +208,6 @@ static inline int kvm_write_guest_lock(struct kvm *kvm, gpa_t gpa,
return ret;
}
-extern void *__kvm_bp_vect_base;
-extern int __kvm_harden_el2_vector_slot;
-
#define kvm_phys_to_vttbr(addr) phys_to_ttbr(addr)
static __always_inline u64 kvm_get_vttbr(struct kvm_s2_mmu *mmu)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index c63c0b3c9b17..3262c16f0449 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -51,6 +51,14 @@ DECLARE_KVM_HYP_PER_CPU(unsigned long, kvm_hyp_vector);
static DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page);
unsigned long kvm_arm_hyp_percpu_base[NR_CPUS];
+/* Hypervisor VA of the indirect vector trampoline page */
+static void *__kvm_bp_vect_base;
+/*
+ * Slot in the hyp vector page for use by the indirect vector trampoline
+ * when mitigation against Spectre-v2 is not required.
+ */
+static int __kvm_harden_el2_vector_slot;
+
/* The VMID used in the VTTBR */
static atomic64_t kvm_vmid_gen = ATOMIC64_INIT(1);
static u32 kvm_next_vmid;
diff --git a/arch/arm64/kvm/va_layout.c b/arch/arm64/kvm/va_layout.c
index e0404bcab019..d1195c288c9f 100644
--- a/arch/arm64/kvm/va_layout.c
+++ b/arch/arm64/kvm/va_layout.c
@@ -131,9 +131,6 @@ void __init kvm_update_va_mask(struct alt_instr *alt,
}
}
-void *__kvm_bp_vect_base;
-int __kvm_harden_el2_vector_slot;
-
void kvm_patch_vector_branch(struct alt_instr *alt,
__le32 *origptr, __le32 *updptr, int nr_inst)
{
--
2.29.2.222.g5d2a92d10f8-goog
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next prev parent reply other threads:[~2020-11-09 21:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-09 21:47 [PATCH v2 0/9] Rework hyp vector handling Will Deacon
2020-11-09 21:47 ` [PATCH v2 1/9] KVM: arm64: Remove redundant Spectre-v2 code from kvm_map_vector() Will Deacon
2020-11-09 21:47 ` [PATCH v2 2/9] KVM: arm64: Tidy up kvm_map_vector() Will Deacon
2020-11-09 21:47 ` [PATCH v2 3/9] KVM: arm64: Move kvm_get_hyp_vector() out of header file Will Deacon
2020-11-09 21:47 ` Will Deacon [this message]
2020-11-09 21:47 ` [PATCH v2 5/9] KVM: arm64: Move BP hardening helpers into spectre.h Will Deacon
2020-11-09 21:47 ` [PATCH v2 6/9] KVM: arm64: Re-jig logic when patching hardened hyp vectors Will Deacon
2020-11-09 21:47 ` [PATCH v2 7/9] KVM: arm64: Allocate hyp vectors statically Will Deacon
2020-11-12 11:07 ` Marc Zyngier
2020-11-12 11:27 ` Will Deacon
2020-11-12 12:05 ` Marc Zyngier
2020-11-12 12:24 ` Will Deacon
2020-11-09 21:47 ` [PATCH v2 8/9] arm64: spectre: Rename ARM64_HARDEN_EL2_VECTORS to ARM64_SPECTRE_V3A Will Deacon
2020-11-09 21:47 ` [PATCH v2 9/9] arm64: spectre: Consolidate spectre-v3a detection Will Deacon
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=20201109214726.15276-5-will@kernel.org \
--to=will@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=kernel-team@android.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=maz@kernel.org \
/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