Linux KVM/arm64 development list
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM: arm64: Fix for mapping incorrect PA at stage-2
@ 2023-04-21  7:16 Oliver Upton
  2023-04-21  7:16 ` [PATCH 1/2] KVM: arm64: Infer the PA offset from IPA in stage-2 map walker Oliver Upton
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Oliver Upton @ 2023-04-21  7:16 UTC (permalink / raw)
  To: kvmarm
  Cc: Marc Zyngier, James Morse, Suzuki K Poulose, Zenghui Yu,
	David Matlack, Reiji Watanabe, Oliver Upton

Ugh.

So it appears that there is a race between two parallel stage-2 map
walkers that could lead to mapping the incorrect PA for a given IPA, as
the IPA -> PA relationship picks up an unintended offset. This series
eliminates the problem by using the current IPA of the walk as the
source-of-truth regarding where we are in a map operation. If you're
curious about the race, it is spelled out in the first patch.

While there is no such race to update hyp's stage-1, the second patch
applies the same rationale to hyp stage-1 walks for the sake of
consistency.

Applies to 6.3-rc3, and merges w/o conflict into kvmarm/next. Took this
for a ride with selftests, kvm-unit-tests, QEMU, and our internal VMM
(affectionately referred to as Vanadium on the list from time to time).
I also ran through the gamut of nVHE, VHE, and pKVM given the effects on
hyp stage-1.

Marc, the bug can have some rather ugly (albeit rare) consequences, so
I'd like to get this in ASAP. The door is shut on 6.3, but it'd be nice
to squeeze in the 6.4 pull request if possible.

Oliver Upton (2):
  KVM: arm64: Infer the PA offset from IPA in stage-2 map walker
  KVM: arm64: Infer PA offset from VA in hyp map walker

 arch/arm64/include/asm/kvm_pgtable.h |  1 +
 arch/arm64/kvm/hyp/pgtable.c         | 35 +++++++++++++++++++++++-----
 2 files changed, 30 insertions(+), 6 deletions(-)


base-commit: e8d018dd0257f744ca50a729e3d042cf2ec9da65
-- 
2.40.0.634.g4ca3ef3211-goog


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

end of thread, other threads:[~2023-04-21 12:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-21  7:16 [PATCH 0/2] KVM: arm64: Fix for mapping incorrect PA at stage-2 Oliver Upton
2023-04-21  7:16 ` [PATCH 1/2] KVM: arm64: Infer the PA offset from IPA in stage-2 map walker Oliver Upton
2023-04-21  9:28   ` Marc Zyngier
2023-04-21  9:35     ` Oliver Upton
2023-04-21  7:16 ` [PATCH 2/2] KVM: arm64: Infer PA offset from VA in hyp " Oliver Upton
2023-04-21  9:12 ` [PATCH 0/2] KVM: arm64: Fix for mapping incorrect PA at stage-2 Marc Zyngier
2023-04-21  9:29   ` Oliver Upton
2023-04-21 12:53 ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox