All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] kvm: arm64: Pointer Authentication handling fixes
@ 2020-06-04 13:33 ` Marc Zyngier
  0 siblings, 0 replies; 24+ messages in thread
From: Marc Zyngier @ 2020-06-04 13:33 UTC (permalink / raw)
  To: kvm, kvmarm, linux-arm-kernel
  Cc: James Morse, Julien Thierry, Suzuki K Poulose, Will Deacon,
	Catalin Marinas, Mark Rutland, kernel-team

I recently discovered that the Pointer Authentication (PtrAuth)
handling code in KVM is busted, and has been for a while. The main
issue is that the we save the host's keys from a preemptible
context. Things will go wrong at some point.

In order to address this, the first patch move the saving of the
host's keys to vcpu_load(). It is done eagerly, which is a bore, but
is at least safe. This is definitely stable material.

The following two patches are adding an optimisation and a fix for a
corner case: we handle key saving and HCR massaging as a fixup, much
like the FPSIMD code. This subsequently allows us to deal with the
ugly case of a guest enabling PtrAuth despite it not being advertised,
resulting in PAC instructions UNDEF'ing while they should be NOPs.

This has been very lightly tested on a model.

Marc Zyngier (3):
  KVM: arm64: Save the host's PtrAuth keys in non-preemptible context
  KVM: arm64: Handle PtrAuth traps early
  KVM: arm64: Enforce PtrAuth being disabled if not advertized

 arch/arm64/include/asm/kvm_emulate.h |  6 ---
 arch/arm64/kvm/arm.c                 |  3 +-
 arch/arm64/kvm/handle_exit.c         | 38 ---------------
 arch/arm64/kvm/hyp/switch.c          | 73 ++++++++++++++++++++++++++++
 arch/arm64/kvm/sys_regs.c            | 13 ++---
 5 files changed, 80 insertions(+), 53 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2020-06-09  7:38 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 13:33 [PATCH 0/3] kvm: arm64: Pointer Authentication handling fixes Marc Zyngier
2020-06-04 13:33 ` Marc Zyngier
2020-06-04 13:33 ` Marc Zyngier
2020-06-04 13:33 ` [PATCH 1/3] KVM: arm64: Save the host's PtrAuth keys in non-preemptible context Marc Zyngier
2020-06-04 13:33   ` Marc Zyngier
2020-06-04 13:33   ` Marc Zyngier
2020-06-04 15:04   ` Mark Rutland
2020-06-04 15:04     ` Mark Rutland
2020-06-04 15:04     ` Mark Rutland
2020-06-04 13:33 ` [PATCH 2/3] KVM: arm64: Handle PtrAuth traps early Marc Zyngier
2020-06-04 13:33   ` Marc Zyngier
2020-06-04 13:33   ` Marc Zyngier
2020-06-04 15:23   ` Mark Rutland
2020-06-04 15:23     ` Mark Rutland
2020-06-04 15:23     ` Mark Rutland
2020-06-04 13:33 ` [PATCH 3/3] KVM: arm64: Enforce PtrAuth being disabled if not advertized Marc Zyngier
2020-06-04 13:33   ` Marc Zyngier
2020-06-04 13:33   ` Marc Zyngier
2020-06-04 15:39   ` Mark Rutland
2020-06-04 15:39     ` Mark Rutland
2020-06-04 15:39     ` Mark Rutland
2020-06-09  7:38     ` Marc Zyngier
2020-06-09  7:38       ` Marc Zyngier
2020-06-09  7:38       ` Marc Zyngier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.