Skip to content

KVM: nVMX: Honor L1-owned CR0 bits for LMSW

Sean Christopherson kvm lkml 1 version Applied

Status from this message: Applied to kvm-x86 vmx, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest5 patches 1 replyApplied

Changes in v3 from the cover letter

- Handle the read_shadow in handle_set_cr0() (and for CR4, because why not).
- Kill off kvm_lmsw() entirely.
- Add a bunch of comments to the selftest to explain the dangers of running with CR0.TS=1.
- Test MOV CR0 as well as LMSW.
- Add a patch to take full ownership of the must-be-1 CR0 and CR4 bits.

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/5KVM: nVMX: Preserve L1-owned bits in CR{0,4} read shadowsarch/x86/kvm/vmx/vmx.c+13 -170 replies
2/5KVM: nVMX: Honor L1-owned CR0 bits when emulating intercepted LMSW for L2arch/x86/kvm/regs.c arch/x86/kvm/regs.h arch/x86/kvm/vmx/vmx.c+4 -90 replies
3/5KVM: nVMX: Synthesize #GP if L2 writes a "bad" CR0 value via LMSWarch/x86/kvm/vmx/vmx.c+2 -30 replies
4/5KVM: nVMX: Take full ownership of the post-VMXON CR{0,4} must-be-1 bitsDocumentation/virt/kvm/api.rst arch/x86/kvm/vmx/nested.c arch/x86/kvm/vmx/vmx.c +1 more+11 -330 replies
5/5KVM: selftests: Verify KVM handling of L1-owned CR0 bits on writes from L2tools/testing/selftests/kvm/include/x86/processor.h tools/testing/selftests/kvm/x86/nested_exceptions_test.c+78 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/5] KVM: nVMX: Honor L1-owned CR0 bits for LMSW

Fix a bug where KVM ignores vmcs12's CR0 guest/host mask when emulating an LMSW from L2, i.e. an LMSW tha exits to L0 but not to L1.

v3:
- Handle the read_shadow in handle_set_cr0() (and for CR4, because why not).
- Kill off kvm_lmsw() entirely.
- Add a bunch of comments to the selftest to explain the dangers of running with CR0.TS=1.
- Test MOV CR0 as well as LMSW.
- Add a patch to take full ownership of the must-be-1 CR0 and CR4 bits.

v2:
- https://lore.kernel.org/all/[email protected]
- Patch 2: order the CR0 store before FNOP and check L2's whole CR0.

v1: https://lore.kernel.org/all/[email protected]

Mahmoud Abumandour (3):
KVM: nVMX: Honor L1-owned CR0 bits when emulating intercepted LMSW for

    L2

KVM: nVMX: Synthesize #GP if L2 writes a "bad" CR0 value via LMSW
KVM: selftests: Verify KVM handling of L1-owned CR0 bits on writes
from L2

Sean Christopherson (2):
KVM: nVMX: Preserve L1-owned bits in CR{0,4} read shadows
KVM: nVMX: Take full ownership of the post-VMXON CR{0,4} must-be-1
bits

 Documentation/virt/kvm/api.rst                |  9 ++-
 arch/x86/kvm/regs.c                           |  6 --
 arch/x86/kvm/regs.h                           |  1 -
 arch/x86/kvm/vmx/nested.c                     | 30 +-------
 arch/x86/kvm/vmx/vmx.c                        | 40 +++++-----
 .../selftests/kvm/include/x86/processor.h     |  5 ++
 .../selftests/kvm/x86/feature_msrs_test.c     |  2 +-
 .../kvm/x86/nested_exceptions_test.c          | 73 +++++++++++++++++++
 8 files changed, 106 insertions(+), 60 deletions(-)

base-commit: 7e60162b16f9da0d2fa83da5c1723b6853a0ac1d

Signature · 1 line
2.56.0.385.gac671c819a-goog