Skip to content

Regression test for L1 LDTR persistence bug

Jim Mattson kvm 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 5 repliesIn review
  2. v13 patches 0 repliesSuperseded

Changes in v2 from the cover letter

Reworded report messages at Sean's suggestion.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3x86: Fix operand size for lldtlib/x86/processor.h+1 -10 replies
2/3x86: Make set_gdt_entry usable in 64-bit modelib/x86/desc.c lib/x86/desc.h x86/cstart64.S+34 -110 replies
3/3x86: Add a regression test for L1 LDTR persistence bugx86/vmx_tests.c+39 -00 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [kvm-unit-tests PATCH v2 0/3] Regression test for L1 LDTR persistence bug

In Linux commit afc8de0118be ("KVM: nVMX: Set LDTR to its architecturally defined value on nested VM-Exit"), Sean suggested that this bug was likely benign, but it turns out that--for us, at least--it can result in live migration failures. On restore, we call KVM_SET_SREGS before KVM_SET_NESTED_STATE, so when L2 is active at the time of save/restore, the target vmcs01 is temporarily populated with L2 values. Hence, the LDTR visible to L1 after the next emulated VM-exit is L2's, rather than its own.

This issue is significant enough that it warrants a regression test. Unfortunately, at the moment, the best we can do is check for the LDTR persistence bug. I'd like to be able to trigger a save/restore from within the L2 guest, but AFAICT, there's no way to do that under qemu. Does anyone want to implement a qemu ISA test device that triggers a save/restore when its configured I/O port is written to?

Jim Mattson (3):
x86: Fix operand size for lldt
x86: Make set_gdt_entry usable in 64-bit mode
x86: Add a regression test for L1 LDTR persistence bug

v1 -> v2:
Reworded report messages at Sean's suggestion.

 lib/x86/desc.c      | 41 +++++++++++++++++++++++++++++++----------
 lib/x86/desc.h      |  3 ++-
 lib/x86/processor.h |  2 +-
 x86/cstart64.S      |  1 +
 x86/vmx_tests.c     | 39 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 74 insertions(+), 12 deletions(-)
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog