Commit 74c1807
committed
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: 517987e ("KVM: x86: add fields to struct kvm_arch for CoCo features")
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20250306202923.646075-1-pbonzini@redhat.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>1 parent adafea1 commit 74c1807
1 file changed
+11
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4580 | 4580 | | |
4581 | 4581 | | |
4582 | 4582 | | |
| 4583 | + | |
| 4584 | + | |
| 4585 | + | |
| 4586 | + | |
| 4587 | + | |
4583 | 4588 | | |
4584 | 4589 | | |
4585 | 4590 | | |
| |||
4688 | 4693 | | |
4689 | 4694 | | |
4690 | 4695 | | |
4691 | | - | |
| 4696 | + | |
4692 | 4697 | | |
4693 | 4698 | | |
4694 | 4699 | | |
| |||
11481 | 11486 | | |
11482 | 11487 | | |
11483 | 11488 | | |
| 11489 | + | |
11484 | 11490 | | |
11485 | 11491 | | |
11486 | 11492 | | |
| |||
11526 | 11532 | | |
11527 | 11533 | | |
11528 | 11534 | | |
11529 | | - | |
11530 | | - | |
| 11535 | + | |
| 11536 | + | |
| 11537 | + | |
11531 | 11538 | | |
11532 | 11539 | | |
11533 | 11540 | | |
| |||
11585 | 11592 | | |
11586 | 11593 | | |
11587 | 11594 | | |
11588 | | - | |
| 11595 | + | |
11589 | 11596 | | |
11590 | 11597 | | |
11591 | 11598 | | |
| |||
0 commit comments