Skip to content

KVM: arm64: Fix teardown of non-protected VMs with pKVM

Will Deacon kvmarm linux-arm-kernel 1 version Applied

Status from this message: Applied to next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/3KVM: arm64: Prevent teardown finalisation of referenced 'hyp_vm'arch/arm64/kvm/hyp/nvhe/pkvm.c+18 -140 replies
2/3KVM: arm64: Allow get_pkvm_hyp_vm() to take a reference to a dying VMarch/arm64/kvm/hyp/nvhe/pkvm.c+1 -70 replies
3/3KVM: arm64: Don't hold 'vm_table_lock' across guest page reclaimarch/arm64/kvm/hyp/nvhe/pkvm.c+7 -60 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by.

PatchMark Brown
SeriesT-b
1/3
2/3
3/3

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/3] KVM: arm64: Fix teardown of non-protected VMs with pKVM

Hi folks,

Sashiko continues to throw rocks at me.

This time, it spotted that my fix (introduced in v5 [1] of the pKVM series) to prevent taking a reference on a VM in the 'is_dying' state also prevents unsharing of pages shared with a non-protected VM if that VM is torn down by its VM fd being destroyed, rather than the usual path via the MMU notifiers.

Rather than send a v6 of the whole series, here are three patches that apply on top of v5 and fix the issue by (a) preventing teardown of a referenced VM and (b) allowing some references to be taken on a dying VM. As an added bonus, this simplifies the locking on the reclaim path because now a VM reference is enough to stop the page-tables from going away.

Cheers,

Will

[1] https://lore.kernel.org/kvmarm/[email protected]

Cc Marc Zyngier <[email protected]>
Cc Oliver Upton <[email protected]>
Cc Joey Gouly <[email protected]>
Cc Suzuki K Poulose <[email protected]>
Cc Zenghui Yu <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Quentin Perret <[email protected]>
Cc Fuad Tabba <[email protected]>
Cc Vincent Donnefort <[email protected]>
Cc Mostafa Saleh <[email protected]>
Cc Alexandru Elisei <[email protected]>

--->8

Will Deacon (3):
KVM: arm64: Prevent teardown finalisation of referenced 'hyp_vm'
KVM: arm64: Allow get_pkvm_hyp_vm() to take a reference to a dying VM
KVM: arm64: Don't hold 'vm_table_lock' across guest page reclaim

 arch/arm64/kvm/hyp/nvhe/pkvm.c | 53 +++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 27 deletions(-)
Signature · 1 line
2.53.0.1118.gaef5881109-goog