]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit5b86c7c4e8ef121f0be635267645566568ea4ab4
tree7e63f5fc23024885fc6f7eb1662f27f1b2ac8e44
parentf02e916643536d5787df4900e1c3f26aadd71b7c
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