From: Marc Zyngier <maz@kernel.org>
To: Will Deacon <will@kernel.org>
Cc: catalin.marinas@arm.com, kernel-team@android.com,
kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH v2 7/9] KVM: arm64: Allocate hyp vectors statically
Date: Thu, 12 Nov 2020 12:05:54 +0000 [thread overview]
Message-ID: <02b35eecdc794886509be67d02c8bcea@kernel.org> (raw)
In-Reply-To: <20201109214726.15276-8-will@kernel.org>
On 2020-11-09 21:47, Will Deacon wrote:
> The EL2 vectors installed when a guest is running point at one of the
> following configurations for a given CPU:
>
> - Straight at __kvm_hyp_vector
> - A trampoline containing an SMC sequence to mitigate Spectre-v2 and
> then a direct branch to __kvm_hyp_vector
> - A dynamically-allocated trampoline which has an indirect branch to
> __kvm_hyp_vector
> - A dynamically-allocated trampoline containing an SMC sequence to
> mitigate Spectre-v2 and then an indirect branch to __kvm_hyp_vector
>
> The indirect branches mean that VA randomization at EL2 isn't trivially
> bypassable using Spectre-v3a (where the vector base is readable by the
> guest).
>
> Rather than populate these vectors dynamically, configure everything
> statically and use an enumerated type to identify the vector "slot"
> corresponding to one of the configurations above. This both simplifies
> the code, but also makes it much easier to implement at EL2 later on.
>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Quentin Perret <qperret@google.com>
> Signed-off-by: Will Deacon <will@kernel.org>
> ---
[...]
> SYM_CODE_START(__bp_harden_hyp_vecs)
> - .rept BP_HARDEN_EL2_SLOTS
> - generate_vectors
> - .endr
> + generate_vectors indirect = 0, spectrev2 = 0 // HYP_VECTOR_DIRECT
> + generate_vectors indirect = 0, spectrev2 = 1 //
> HYP_VECTOR_SPECTRE_DIRECT
> + generate_vectors indirect = 1, spectrev2 = 0 // HYP_VECTOR_INDIRECT
> + generate_vectors indirect = 1, spectrev2 = 1 //
> HYP_VECTOR_SPECTRE_INDIRECT
Another nit (though I'm not sure if it it's a regression or not):
Why do we generate a set of hardened vectors for HYP_VECTOR_DIRECT?
The code in kvm_init_vector_slots() directly points the per-CPU VBAR
to __kvm_hyp_vector, which is the right thing to do. I don't think we
ever use slot 0 in __bp_harden_hyp_vecs, wasting 2kB of text.
Did I miss something?
M.
--
Jazz is not dead. It just smells funny...
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next prev parent reply other threads:[~2020-11-12 12:06 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 ` [PATCH v2 4/9] KVM: arm64: Make BP hardening globals static instead Will Deacon
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 [this message]
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=02b35eecdc794886509be67d02c8bcea@kernel.org \
--to=maz@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=kernel-team@android.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=will@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