Skip to content
Commit 74c1807f authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

KVM: x86: block KVM_CAP_SYNC_REGS if guest state is protected



KVM_CAP_SYNC_REGS does not make sense for VMs with protected guest state,
since the register values cannot actually be written.  Return 0
when using the VM-level KVM_CHECK_EXTENSION ioctl, and accordingly
return -EINVAL from KVM_RUN if the valid/dirty fields are nonzero.

However, on exit from KVM_RUN userspace could have placed a nonzero
value into kvm_run->kvm_valid_regs, so check guest_state_protected
again and skip store_regs() in that case.

Cc: stable@vger.kernel.org
Fixes: 517987e3 ("KVM: x86: add fields to struct kvm_arch for CoCo features")
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Message-ID: <20250306202923.646075-1-pbonzini@redhat.com>
Reviewed-by: default avatarPankaj Gupta <pankaj.gupta@amd.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent adafea11
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment