KVM: nVMX: Fix size checks in vmx_set_nested_state
Quoted 49 lines · Jim Mattson
Quoted 47 lines · Jim Mattson
Quoted 44 lines · Krish Sadhukhan
Quoted 40 lines · Jim Mattson
Quoted 39 lines · Jim Mattson
Quoted 36 lines · Jim Mattson
The size checks in
vmx_nested_stateare wrong because the calculations are made based on the size of a pointer to a structkvm_nested_staterather than the size of a structkvm_nested_state.Reported-by Felix Wilhelm <[email protected]>Signed-off-by Jim Mattson <[email protected]>Reviewed-by Drew Schmitt <[email protected]>Reviewed-by Marc Orr <[email protected]>Reviewed-by Peter Shier <[email protected]>--- arch/x86/kvm/vmx/nested.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/vmx/nested.c +2
-3@@ -5351,7 +5351,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,return ret;/* Empty 'VMXON' state is permitted */ -if (kvm_state->size <sizeof (kvm_state) +sizeof (*vmcs12)) +if (kvm_state->size <sizeof (*kvm_state) +sizeof (*vmcs12))return 0 ;if (kvm_state->vmx.vmcs_pa !=-1ull ) {@@ -5395,7 +5395,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, vmcs12->vmcs_link_pointer != -1ull) {struct vmcs12 *shadow_vmcs12 =get_shadow_vmcs12 (vcpu); -if (kvm_state->size <sizeof (kvm_state) +2 *sizeof (*vmcs12)) +if (kvm_state->size <sizeof (*kvm_state) +2 *sizeof (*vmcs12))return -EINVAL ; if (copy_from_user(shadow_vmcs12, --Quoted 1 line
2.20.1.97.g81188d93c3-goog
Ping.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
Ping again?
Reviewed-by Krish Sadhukhan <[email protected]>Ping again, just for grins.
Ping.
This seems pretty straightforward. Am I missing something?
Paolo Bonzini
maintainerQuoted 50 lines · Jim Mattson
Quoted 49 lines · Jim Mattson
Quoted 47 lines · Jim Mattson
Quoted 44 lines · Krish Sadhukhan
Quoted 40 lines · Jim Mattson
Quoted 39 lines · Jim Mattson
Quoted 36 lines · Jim Mattson
The size checks in
vmx_nested_stateare wrong because the calculations are made based on the size of a pointer to a structkvm_nested_staterather than the size of a structkvm_nested_state.Reported-by Felix Wilhelm <[email protected]>Signed-off-by Jim Mattson <[email protected]>Reviewed-by Drew Schmitt <[email protected]>Reviewed-by Marc Orr <[email protected]>Reviewed-by Peter Shier <[email protected]>--- arch/x86/kvm/vmx/nested.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/vmx/nested.c +2
-3@@ -5351,7 +5351,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,return ret;/* Empty 'VMXON' state is permitted */ -if (kvm_state->size <sizeof (kvm_state) +sizeof (*vmcs12)) +if (kvm_state->size <sizeof (*kvm_state) +sizeof (*vmcs12))return 0 ;if (kvm_state->vmx.vmcs_pa !=-1ull ) {@@ -5395,7 +5395,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, vmcs12->vmcs_link_pointer != -1ull) {struct vmcs12 *shadow_vmcs12 =get_shadow_vmcs12 (vcpu); -if (kvm_state->size <sizeof (kvm_state) +2 *sizeof (*vmcs12)) +if (kvm_state->size <sizeof (*kvm_state) +2 *sizeof (*vmcs12))return -EINVAL ; if (copy_from_user(shadow_vmcs12, --Quoted 1 line
2.20.1.97.g81188d93c3-goog
Ping.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
Ping again?
Reviewed-by Krish Sadhukhan <[email protected]>Ping again, just for grins.
Ping.
This seems pretty straightforward. Am I missing something?
Nope, I just missed it again and again. I've queued it now.
Paolo