]> git.proxmox.com Git - mirror_ubuntu-hirsute-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)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 7 May 2021 07:54:06 +0000 (09:54 +0200)
commitd2be95d4496157a1b2e27cef45fff26cb02ec806
treefa81beb9d148304c3e08be3989a852678ec6f751
parenta6bdda1fb96782e5bbb3e2eba26ab535b9e797c2
KVM: VMX: Don't use vcpu->run->internal.ndata as an array index

BugLink: https://bugs.launchpad.net/bugs/1926999
[ Upstream commit 04c4f2ee3f68c9a4bf1653d15f1a9a435ae33f7a ]

__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: 1aa561b1a4c0 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/x86/kvm/vmx/vmx.c