mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 20:10:23 +09:00
ANDROID: KVM: arm64: Fix for do not allow memslot changes after first VM run under pKVM
Move the check for protected VMs up to ensure that we don't miss a KVM_MR_DELETE. Bug: 231684412 Change-Id: Ia5cecc13232e8c430f2a1747a3cebd7e7bd5e348 Signed-off-by: Fuad Tabba <tabba@google.com>
This commit is contained in:
@@ -1853,10 +1853,6 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
|
||||
hva_t reg_end = hva + mem->memory_size;
|
||||
int ret = 0;
|
||||
|
||||
if (change != KVM_MR_CREATE && change != KVM_MR_MOVE &&
|
||||
change != KVM_MR_FLAGS_ONLY)
|
||||
return 0;
|
||||
|
||||
/* In protected mode, cannot modify memslots once a VM has run. */
|
||||
if (is_protected_kvm_enabled() &&
|
||||
(change == KVM_MR_DELETE || change == KVM_MR_MOVE) &&
|
||||
@@ -1864,6 +1860,10 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
if (change != KVM_MR_CREATE && change != KVM_MR_MOVE &&
|
||||
change != KVM_MR_FLAGS_ONLY)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Prevent userspace from creating a memory region outside of the IPA
|
||||
* space addressable by the KVM guest IPA space.
|
||||
|
||||
Reference in New Issue
Block a user