Skip to content

Fix __pkvm_init_vm error path

Vincent Donnefort kvmarm linux-arm-kernel 4 versions Applied

Status from this message: Applied to next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest posting 2/23 patches 2 repliesApplied
  2. v3 posting 1/21 of 3 patches 1 replySuperseded
  3. v23 patches 6 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches0 repliesSuperseded

Changes since v3 from the cover letter

* Enforce order-0 for external pages, making the vmemmap ->order field completely private to hyp_pool.

Patches in v3 posting 2/2 Applied

#Subject and filesSizeRepliesApplied
1/3KVM: arm64: Reset page order in pKVM hyp_poolarch/arm64/kvm/hyp/nvhe/mem_protect.c arch/arm64/kvm/hyp/nvhe/page_alloc.c+16 -71 reply
2/3KVM: arm64: Fix __pkvm_init_vm error patharch/arm64/kvm/hyp/include/nvhe/mem_protect.h arch/arm64/kvm/hyp/nvhe/mem_protect.c arch/arm64/kvm/hyp/nvhe/pkvm.c+13 -50 replies
3/3KVM: arm64: Add fail-safe for refcounted pages in __pkvm_hyp_donate_hostarch/arm64/kvm/hyp/nvhe/mem_protect.c+16 -40 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchFuad Tabba
1/3R-b T-b
2/3R-b T-b
3/3R-b T-b

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

Read the v3 thread

Cover letter [RESEND v3 0/3] Fix __pkvm_init_vm error path

Sashiko reported a potential refcount leak in the unlikely case where insert_vm_table_entry fails.

While at it, I have added a fail-safe to __pkvm_hyp_donate_host to ensure this function doesn't allow leaking refcounted pages.

Changes since v3:

* Enforce order-0 for external pages, making the vmemmap ->order field completely private to hyp_pool.

Changes since v2 (https://lore.kernel.org/all/[email protected]/):

* Proactively init hyp_page order field in hyp_pool_init

v1 (https://lore.kernel.org/all/[email protected]/)

Vincent Donnefort (3):
KVM: arm64: Reset page order in pKVM hyp_pool
KVM: arm64: Fix __pkvm_init_vm error path
KVM: arm64: Add fail-safe for refcounted pages in
__pkvm_hyp_donate_host

 arch/arm64/kvm/hyp/include/nvhe/mem_protect.h |  1 +
 arch/arm64/kvm/hyp/nvhe/mem_protect.c         | 35 +++++++++++++------
 arch/arm64/kvm/hyp/nvhe/page_alloc.c          | 21 ++++++++---
 arch/arm64/kvm/hyp/nvhe/pkvm.c                |  4 ++-
 4 files changed, 45 insertions(+), 16 deletions(-)

base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8

Signature · 1 line
2.54.0.746.g67dd491aae-goog