[PATCH 0/4] KVM: nSVM: Fix save/restore of next_rip & int_state

Yosry Ahmed posted 4 patches 3 hours ago
arch/x86/kvm/svm/nested.c                    |  7 ++--
arch/x86/kvm/svm/svm.c                       | 26 +++++++++------
tools/testing/selftests/kvm/x86/state_test.c | 35 ++++++++++++++++++++
3 files changed, 55 insertions(+), 13 deletions(-)
[PATCH 0/4] KVM: nSVM: Fix save/restore of next_rip & int_state
Posted by Yosry Ahmed 3 hours ago
next_rip and int_state are both not sync'd correctly to the cached
vmcb12 after VMRUN of L2. Sync the cached vmcb12 is the payload of
nested state, these fields are not saved/restored correctly.

Sync both fields correctly, and extend state_test to check vGIF (already
sync'd field) and next_rip. Checking the interrupt shadow would be
tricky, as GUEST_SYNC() executes several instructions before exiting to
L0, so the interrupt shadow will be consumed before the test can check
for it. L2 could execute STI followed directly by in/out, but that would
not handle transitioning between L2 and L2 correctly (see
ucall_arch_do_ucall()).

Yosry Ahmed (4):
  KVM: nSVM: Sync next_rip to cached vmcb12 after VMRUN of L2
  KVM: nSVM: Sync int_state to cached vmcb12 after VMRUN of L2
  KVM: selftests: Extend state_test to check vGIF
  KVM: selftests: Extend state_test to check next_rip

 arch/x86/kvm/svm/nested.c                    |  7 ++--
 arch/x86/kvm/svm/svm.c                       | 26 +++++++++------
 tools/testing/selftests/kvm/x86/state_test.c | 35 ++++++++++++++++++++
 3 files changed, 55 insertions(+), 13 deletions(-)


base-commit: e944fe2c09f405a2e2d147145c9b470084bc4c9a
-- 
2.53.0.rc2.204.g2597b5adb4-goog