mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
KVM: arm64: Prevent unsupported memslot operations on protected VMs
Protected VMs do not support deleting or moving memslots after first run nor do they support read-only or dirty logging. Return -EPERM to userspace if such an operation is attempted. Reviewed-by: Fuad Tabba <tabba@google.com> Tested-by: Fuad Tabba <tabba@google.com> Tested-by: Mostafa Saleh <smostafa@google.com> Signed-off-by: Will Deacon <will@kernel.org> Link: https://patch.msgid.link/20260330144841.26181-10-will@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
committed by
Marc Zyngier
parent
7250533ad2
commit
f0877a1455
@@ -192,10 +192,16 @@ int pkvm_create_hyp_vm(struct kvm *kvm)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* Synchronise with kvm_arch_prepare_memory_region(), as we
|
||||
* prevent memslot modifications on a pVM that has been run.
|
||||
*/
|
||||
mutex_lock(&kvm->slots_lock);
|
||||
mutex_lock(&kvm->arch.config_lock);
|
||||
if (!pkvm_hyp_vm_is_created(kvm))
|
||||
ret = __pkvm_create_hyp_vm(kvm);
|
||||
mutex_unlock(&kvm->arch.config_lock);
|
||||
mutex_unlock(&kvm->slots_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user