Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull KVM fixes from Paolo Bonzini: "Bugfixes and strengthening the validity checks on inputs from new userspace APIs. Now I know why I shouldn't prepare pull requests on the weekend, it's hard to concentrate if your son is shouting about his latest Minecraft builds in your ear. Fortunately all the patches were ready and I just had to check the test results..." * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: KVM: SVM: Fix disable pause loop exit/pause filtering capability on SVM KVM: LAPIC: Prevent setting the tscdeadline timer if the lapic is hw disabled KVM: arm64: Don't inherit exec permission across page-table levels KVM: arm64: Prevent vcpu_has_ptrauth from generating OOL functions KVM: nVMX: check for invalid hdr.vmx.flags KVM: nVMX: check for required but missing VMCS12 in KVM_SET_NESTED_STATE selftests: kvm: do not set guest mode flag
This commit is contained in:
@@ -76,10 +76,8 @@ void set_default_state(struct kvm_nested_state *state)
|
||||
void set_default_vmx_state(struct kvm_nested_state *state, int size)
|
||||
{
|
||||
memset(state, 0, size);
|
||||
state->flags = KVM_STATE_NESTED_GUEST_MODE |
|
||||
KVM_STATE_NESTED_RUN_PENDING;
|
||||
if (have_evmcs)
|
||||
state->flags |= KVM_STATE_NESTED_EVMCS;
|
||||
state->flags = KVM_STATE_NESTED_EVMCS;
|
||||
state->format = 0;
|
||||
state->size = size;
|
||||
state->hdr.vmx.vmxon_pa = 0x1000;
|
||||
@@ -148,6 +146,11 @@ void test_vmx_nested_state(struct kvm_vm *vm)
|
||||
state->hdr.vmx.smm.flags = 1;
|
||||
test_nested_state_expect_einval(vm, state);
|
||||
|
||||
/* Invalid flags are rejected. */
|
||||
set_default_vmx_state(state, state_sz);
|
||||
state->hdr.vmx.flags = ~0;
|
||||
test_nested_state_expect_einval(vm, state);
|
||||
|
||||
/* It is invalid to have vmxon_pa == -1ull and vmcs_pa != -1ull. */
|
||||
set_default_vmx_state(state, state_sz);
|
||||
state->hdr.vmx.vmxon_pa = -1ull;
|
||||
@@ -185,22 +188,43 @@ void test_vmx_nested_state(struct kvm_vm *vm)
|
||||
state->hdr.vmx.smm.flags = KVM_STATE_NESTED_SMM_GUEST_MODE;
|
||||
test_nested_state_expect_einval(vm, state);
|
||||
|
||||
/* Size must be large enough to fit kvm_nested_state and vmcs12. */
|
||||
/*
|
||||
* Size must be large enough to fit kvm_nested_state and vmcs12
|
||||
* if VMCS12 physical address is set
|
||||
*/
|
||||
set_default_vmx_state(state, state_sz);
|
||||
state->size = sizeof(*state);
|
||||
state->flags = 0;
|
||||
test_nested_state_expect_einval(vm, state);
|
||||
|
||||
set_default_vmx_state(state, state_sz);
|
||||
state->size = sizeof(*state);
|
||||
state->flags = 0;
|
||||
state->hdr.vmx.vmcs12_pa = -1;
|
||||
test_nested_state(vm, state);
|
||||
|
||||
/*
|
||||
* KVM_SET_NESTED_STATE succeeds with invalid VMCS
|
||||
* contents but L2 not running.
|
||||
*/
|
||||
set_default_vmx_state(state, state_sz);
|
||||
state->flags = 0;
|
||||
test_nested_state(vm, state);
|
||||
|
||||
/* Invalid flags are rejected, even if no VMCS loaded. */
|
||||
set_default_vmx_state(state, state_sz);
|
||||
state->size = sizeof(*state);
|
||||
state->flags = 0;
|
||||
state->hdr.vmx.vmcs12_pa = -1;
|
||||
state->hdr.vmx.flags = ~0;
|
||||
test_nested_state_expect_einval(vm, state);
|
||||
|
||||
/* vmxon_pa cannot be the same address as vmcs_pa. */
|
||||
set_default_vmx_state(state, state_sz);
|
||||
state->hdr.vmx.vmxon_pa = 0;
|
||||
state->hdr.vmx.vmcs12_pa = 0;
|
||||
test_nested_state_expect_einval(vm, state);
|
||||
|
||||
/* The revision id for vmcs12 must be VMCS12_REVISION. */
|
||||
set_default_vmx_state(state, state_sz);
|
||||
set_revision_id_for_vmcs12(state, 0);
|
||||
test_nested_state_expect_einval(vm, state);
|
||||
|
||||
/*
|
||||
* Test that if we leave nesting the state reflects that when we get
|
||||
* it again.
|
||||
|
Reference in New Issue
Block a user