Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM: arm64: Fix host/hyp tracking on share/unshare hypercall failure
@ 2026-05-29  7:43 tabba
  2026-05-29  7:43 ` [PATCH 1/2] KVM: arm64: Free hyp-share tracking node when share hypercall fails tabba
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: tabba @ 2026-05-29  7:43 UTC (permalink / raw)
  To: Marc Zyngier, Oliver Upton, Joey Gouly, Suzuki K Poulose,
	Zenghui Yu, Catalin Marinas, Will Deacon, Quentin Perret,
	Vincent Donnefort
  Cc: linux-arm-kernel, kvmarm, linux-kernel

Hi folks,

Yet another bug I found while testing Sashiko locally with fixes to
review-prompts.

share_pfn_hyp() and unshare_pfn_hyp() in arch/arm64/kvm/mmu.c
maintain a host-side RB-tree mirroring the set of pages shared with
EL2. Both invoke a hypercall that can fail (page-state mismatch,
EL2 refcount still held), but neither cleans up on failure:

- share_pfn_hyp() inserts the tracking node before the hypercall
  and leaves it in the tree on failure, leaking the allocation and
  presenting a phantom share to a later unshare.

- unshare_pfn_hyp() erases the tracking node before the hypercall;
  on failure the host loses its record while EL2 still owns the
  share, breaking later operations on the same pfn.

Severity is low (no isolation impact) and the failure paths are rare
in practice, but the desync is real. Both patches are independent and
apply cleanly to current mainline. In other words, this can wait for
7.2.

Cheers,
/fuad

Fuad Tabba (2):
  KVM: arm64: Free hyp-share tracking node when share hypercall fails
  KVM: arm64: Avoid host/hyp share desync on unshare hypercall failure

 arch/arm64/kvm/mmu.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

-- 
2.54.0.929.g9b7fa37559-goog



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

end of thread, other threads:[~2026-05-29 10:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-29  7:43 [PATCH 0/2] KVM: arm64: Fix host/hyp tracking on share/unshare hypercall failure tabba
2026-05-29  7:43 ` [PATCH 1/2] KVM: arm64: Free hyp-share tracking node when share hypercall fails tabba
2026-05-29  7:43 ` [PATCH 2/2] KVM: arm64: Avoid host/hyp share desync on unshare hypercall failure tabba
2026-05-29  8:02 ` [PATCH 0/2] KVM: arm64: Fix host/hyp tracking on share/unshare " Vincent Donnefort
2026-05-29  8:05   ` Fuad Tabba
2026-05-29  8:15     ` Marc Zyngier
2026-05-29  8:20       ` Fuad Tabba
2026-05-29  9:21         ` Vincent Donnefort
2026-05-29  9:23           ` Fuad Tabba
2026-05-29 10:07             ` Vincent Donnefort
2026-05-29  9:29         ` Marc Zyngier
2026-05-29 10:06           ` Vincent Donnefort

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