Web lists-archives.com

[PATCH for-4.15 0/5] KVM: (almost) emulate UMIP on current processors

The User-Mode Instruction Prevention feature present in recent Intel
processor prevents a group of instructions (sgdt, sidt, sldt, smsw, and
str) from being executed with CPL > 0. Otherwise, a general protection
fault is issued.

Add support for UMIP in virtual machines, and also allow emulation of
UMIP on older processors by enabling descriptor-table vmexits.  This
emulation is not perfect, because SMSW cannot be trapped.  However,
this is not an issue in practice because Linux is _also_ emulating SMSW
instructions on behalf of the program that executes them, because some
16-bit programs expect to use SMSW to detect vm86 mode.


Paolo Bonzini (5):
  KVM: vmx: use X86_CR4_UMIP and X86_FEATURE_UMIP
  KVM: x86: add support for UMIP
  KVM: x86: emulate sldt and str
  KVM: x86: add support for emulating UMIP
  KVM: vmx: add support for emulating UMIP

 arch/x86/include/asm/kvm_host.h |  3 ++-
 arch/x86/kvm/cpuid.c            |  6 ++++--
 arch/x86/kvm/emulate.c          | 40 ++++++++++++++++++++++++++++++++++------
 arch/x86/kvm/svm.c              |  6 ++++++
 arch/x86/kvm/vmx.c              | 36 +++++++++++++++++++++++++++++++++---
 arch/x86/kvm/x86.c              |  3 +++
 6 files changed, 82 insertions(+), 12 deletions(-)