diff options
author | Sean Christopherson <sean.j.christopherson@intel.com> | 2019-09-02 08:33:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-16 08:22:05 +0200 |
commit | cd490d44150da6e7600fcee57d2480c6e2b9609c (patch) | |
tree | 2647e45f08e9deefa7c20a8963805c7a2a6ce56d /Documentation/parisc | |
parent | 687e470e9123a72a25ba56e9dec5929619edf4b1 (diff) | |
download | linux-stable-cd490d44150da6e7600fcee57d2480c6e2b9609c.tar.gz linux-stable-cd490d44150da6e7600fcee57d2480c6e2b9609c.tar.bz2 linux-stable-cd490d44150da6e7600fcee57d2480c6e2b9609c.zip |
KVM: VMX: Compare only a single byte for VMCS' "launched" in vCPU-run
[ Upstream commit 61c08aa9606d4e48a8a50639c956448a720174c3 ]
The vCPU-run asm blob does a manual comparison of a VMCS' launched
status to execute the correct VM-Enter instruction, i.e. VMLAUNCH vs.
VMRESUME. The launched flag is a bool, which is a typedef of _Bool.
C99 does not define an exact size for _Bool, stating only that is must
be large enough to hold '0' and '1'. Most, if not all, compilers use
a single byte for _Bool, including gcc[1].
Originally, 'launched' was of type 'int' and so the asm blob used 'cmpl'
to check the launch status. When 'launched' was moved to be stored on a
per-VMCS basis, struct vcpu_vmx's "temporary" __launched flag was added
in order to avoid having to pass the current VMCS into the asm blob.
The new '__launched' was defined as a 'bool' and not an 'int', but the
'cmp' instruction was not updated.
This has not caused any known problems, likely due to compilers aligning
variables to 4-byte or 8-byte boundaries and KVM zeroing out struct
vcpu_vmx during allocation. I.e. vCPU-run accesses "junk" data, it just
happens to always be zero and so doesn't affect the result.
[1] https://gcc.gnu.org/ml/gcc-patches/2000-10/msg01127.html
Fixes: d462b8192368 ("KVM: VMX: Keep list of loaded VMCSs, instead of vcpus")
Cc: <stable@vger.kernel.org>
Reviewed-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'Documentation/parisc')
0 files changed, 0 insertions, 0 deletions