ANDROID: KVM: arm64: poison/account relinquished pages after unmap
If the page is poisoned and accounted before the unmap: 1. The guest has a window to access and dirty the page after the poison and related CMOs 2. If the unmap fails, the hypercall has visible side effect (poisoning) and leaves an incorrect PSCI MEM_PROTECT count. Bug: 357781595 Bug: 433953177 Change-Id: Id67f2dda632bca686e2509f1c64d08743deef199 Signed-off-by: Keir Fraser <keirf@google.com>
This commit is contained in:
@@ -431,14 +431,14 @@ int __pkvm_guest_relinquish_to_host(struct pkvm_hyp_vcpu *vcpu,
|
||||
goto end;
|
||||
}
|
||||
|
||||
hyp_poison_page(phys, PAGE_SIZE);
|
||||
psci_mem_protect_dec(1);
|
||||
|
||||
/* Zap the guest stage2 pte and return ownership to the host */
|
||||
ret = kvm_pgtable_stage2_unmap(&vm->pgt, ipa, PAGE_SIZE);
|
||||
if (ret)
|
||||
goto end;
|
||||
|
||||
hyp_poison_page(phys, PAGE_SIZE);
|
||||
psci_mem_protect_dec(1);
|
||||
|
||||
WARN_ON(host_stage2_set_owner_locked(phys, PAGE_SIZE, PKVM_ID_HOST));
|
||||
end:
|
||||
guest_unlock_component(vm);
|
||||
|
||||
Reference in New Issue
Block a user