mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 12:00:22 +09:00
ANDROID: KVM: arm64: Invalidate TLB by VMID when tearing down the shadow VM
When a shadow VM is torn down, its VMID can be reallocated as soon as the shadow table entry is cleared to NULL. Since tearing down the stage-2 page-table does not imply TLB invalidation, the TLB could still contain stale entries from the old VM and the new user of the VMID could end up seeing erroneous translations. Invalidate the TLB for the VMID of the VM being torn down prior to clearing its entry in the shadow table. Bug: 226312378 Signed-off-by: Will Deacon <willdeacon@google.com> Change-Id: Ice44d030bf01a1b7612413ee32440f3f38cb3e4e
This commit is contained in:
@@ -678,6 +678,8 @@ int __pkvm_teardown_shadow(int shadow_handle)
|
||||
goto err_unlock;
|
||||
}
|
||||
|
||||
/* Ensure the VMID is clean before it can be reallocated */
|
||||
__kvm_tlb_flush_vmid(&vm->arch.mmu);
|
||||
remove_shadow_table(shadow_handle);
|
||||
hyp_spin_unlock(&shadow_lock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user