Skip to content

KVM: arm64: Fix for mapping incorrect PA at stage-2

Oliver Upton kvmarm stable 1 version Applied

Status from this message: Applied to next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2KVM: arm64: Infer the PA offset from IPA in stage-2 map walkerarch/arm64/include/asm/kvm_pgtable.h arch/arm64/kvm/hyp/pgtable.c+29 -42 replies
2/2KVM: arm64: Infer PA offset from VA in hyp map walkerarch/arm64/kvm/hyp/pgtable.c+1 -20 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchOliver Upton
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] KVM: arm64: Fix for mapping incorrect PA at stage-2

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

Signature · 1 line
2.40.0.634.g4ca3ef3211-goog