Skip to content

Big real mode fixes

Avi Kivity kvm 1 version Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/13KVM: VMX: Separate saving pre-realmode state from setting segmentsarch/x86/kvm/vmx.c+13 -70 replies
2/13KVM: VMX: Fix incorrect lookup of segment S flag in fix_pmode_dataseg()arch/x86/kvm/vmx.c+2 -20 replies
3/13KVM: VMX: Use kvm_segment to save protected-mode segments when entering realmodearch/x86/kvm/vmx.c+24 -610 replies
4/13KVM: VMX: Retain limit and attributes when entering protected modearch/x86/kvm/vmx.c+6 -60 replies
5/13KVM: VMX: Allow real mode emulation using vm86 with dpl=0arch/x86/kvm/vmx.c+1 -10 replies
6/13KVM: VMX: Allow vm86 virtualization of big real modearch/x86/kvm/vmx.c+1 -10 replies
7/13KVM: x86 emulator: Leave segment limit and attributs alone in real modearch/x86/kvm/emulate.c+2 -60 replies
8/13KVM: x86 emulator: Check segment limits in real mode tooarch/x86/kvm/emulate.c+4 -30 replies
9/13KVM: x86 emulator: Fix #GP error code during linearizationarch/x86/kvm/emulate.c+2 -20 replies
10/13KVM: VMX: Return real real-mode segment data even if emulate_invalid_guest_state=1arch/x86/kvm/vmx.c+1 -20 replies
11/13KVM: VMX: Preserve segment limit and access rights in real modearch/x86/kvm/vmx.c+3 -00 replies
12/13KVM: VMX: Save all segment data in real modearch/x86/kvm/vmx.c+1 -00 replies
13/13KVM: VMX: Ignore segment G and D bits when considering whether we can virtualizearch/x86/kvm/vmx.c+1 -10 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 00/13] Big real mode fixes

It turns out that our big real mode implementation was based on a miconception:
I believed that loading a segment register in real mode causes the limit to be reset to 0xffff (thus undoing the effect), while in reality, the limit is preserved across segment changes. This bug was hidden by another bug: we didn't do limit checks in real mode. So even though segment loads corrupted the limit, the guest still functioned because that limit isn't checked.

This patchset fixes both bugs, and introduces an optimization: we can now use vm86 mode to virtualize big real mode (under usually-met conditions). This both speeds up big real mode, and makes it more robust, since fewer instructions need to be emulated.

I think this patchset means we can remove emulate_invalid_guest_state=0, since it offers no advantages now.

Avi Kivity (13):
KVM: VMX: Separate saving pre-realmode state from setting segments
KVM: VMX: Fix incorrect lookup of segment S flag in
fix_pmode_dataseg()
KVM: VMX: Use kvm_segment to save protected-mode segments when
entering realmode
KVM: VMX: Retain limit and attributes when entering protected mode
KVM: VMX: Allow real mode emulation using vm86 with dpl=0
KVM: VMX: Allow vm86 virtualization of big real mode
KVM: x86 emulator: Leave segment limit and attributs alone in real
mode
KVM: x86 emulator: Check segment limits in real mode too
KVM: x86 emulator: Fix #GP error code during linearization
KVM: VMX: Return real real-mode segment data even if
emulate_invalid_guest_state=1
KVM: VMX: Preserve segment limit and access rights in real mode
KVM: VMX: Save all segment data in real mode
KVM: VMX: Ignore segment G and D bits when considering whether we can
virtualize

 arch/x86/kvm/emulate.c |  19 ++++------
 arch/x86/kvm/vmx.c     | 100 ++++++++++++++++++-------------------------------
 2 files changed, 44 insertions(+), 75 deletions(-)
Signature · 1 line
1.7.11.3