KVM: arm64: Save the host's PtrAuth keys in non-preemptible context
authorMarc Zyngier <maz@kernel.org>
Wed, 3 Jun 2020 17:24:01 +0000 (18:24 +0100)
committerMarc Zyngier <maz@kernel.org>
Tue, 9 Jun 2020 09:44:40 +0000 (10:44 +0100)
commitef3e40a7ea8dbe2abd0a345032cd7d5023b9684f
tree7e63f5fc23024885fc6f7eb1662f27f1b2ac8e44
parent7ae2f3db6167aa7184529fdacd1de72619baf93b
KVM: arm64: Save the host's PtrAuth keys in non-preemptible context

When using the PtrAuth feature in a guest, we need to save the host's
keys before allowing the guest to program them. For that, we dump
them in a per-CPU data structure (the so called host context).

But both call sites that do this are in preemptible context,
which may end up in disaster should the vcpu thread get preempted
before reentering the guest.

Instead, save the keys eagerly on each vcpu_load(). This has an
increased overhead, but is at least safe.

Cc: stable@vger.kernel.org
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/include/asm/kvm_emulate.h
arch/arm64/kvm/arm.c
arch/arm64/kvm/handle_exit.c