]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: VMX: Don't use vcpu->run->internal.ndata as an array index
authorReiji Watanabe <reijiw@google.com>
Tue, 13 Apr 2021 15:47:40 +0000 (15:47 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 13 Apr 2021 22:23:41 +0000 (18:23 -0400)
commit61ea08805d2e3d2dd8173d5b7906dcca2e65f02f
tree43993d21b858cc8b24c9f6cb909f2dd837fb3bcb
parentb86db5a1c7941676cde2183ae75f6471383dda7e
KVM: VMX: Don't use vcpu->run->internal.ndata as an array index

__vmx_handle_exit() uses vcpu->run->internal.ndata as an index for
an array access.  Since vcpu->run is (can be) mapped to a user address
space with a writer permission, the 'ndata' could be updated by the
user process at anytime (the user process can set it to outside the
bounds of the array).
So, it is not safe that __vmx_handle_exit() uses the 'ndata' that way.

Fixes: 73062caf6795 ("kvm: x86: Add "last CPU" to some KVM_EXIT information")
Signed-off-by: Reiji Watanabe <reijiw@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Message-Id: <20210413154739.490299-1-reijiw@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.c