[RESEND v3 0/3] Fix __pkvm_init_vm error path
Vincent Donnefort
vdonnefort at google.com
Thu May 21 07:36:23 PDT 2026
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/20260521102149.804874-1-vdonnefort@google.com/):
* Proactively init hyp_page order field in hyp_pool_init
v1 (https://lore.kernel.org/all/20260521081250.655226-1-vdonnefort@google.com/)
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
--
2.54.0.746.g67dd491aae-goog
More information about the linux-arm-kernel
mailing list