Skip to content

x86: Prevent Split-Lock-Detection wreckage on VMX hypervisors

Thomas Gleixner kvm lkml oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 34 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2x86,module: Detect VMX modules and disable Split-Lock-Detectarch/x86/include/asm/cpu.h arch/x86/kernel/cpu/intel.c arch/x86/kernel/module.c +2 more+54 -135 replies
2/2x86/kvm/vmx: Prevent split lock detection induced #AC wreckagearch/x86/include/asm/cpu.h arch/x86/kernel/cpu/intel.c arch/x86/kvm/vmx/vmx.c+61 -828 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchTony LuckPaolo Bonzini
1/2
2/2R-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch 0/2] x86: Prevent Split-Lock-Detection wreckage on VMX hypervisors

Kenneth reported that a VMWare guest crashes in the VMWare BIOS due to a Split-Lock induced #AC which is injected by the VMWare hypervisor into the guest.

While this is a good thing in principle, it's not really practical. That means that Split-Lock-Detection has to be disabled when any unprepared VMX hypervisor is loaded.

As hypervisor modules are not really identifiable, the only safe solution we came up with is to scan the module text at load time for a VMLAUNCH instruction. If VMLAUNCH is found then Split-Lock-Detection is disabled on the host to prevent the above. If the hypervisor has at least minimal handling code, the module can tell the kernel by adding MOD_INFO(sld_safe, "Y") which disables the text scan.

For KVM it's simple enough to handle it at least at the basic level by checking guest CR0.AM and EFLAGS.AC state and a trivial host side handler which depending on the SLD mode handles it gracefully or tells the VMX handler to deliver the #AC to user space which then can crash and burn itself.

As Peter and myself don't have access to a SLD enabled machine, the KVM/VMX part is untested. The module scan part works.

Alternatively we can obviously revert SLD, but that does not make the problem vs. out of tree hypervisors go away magically. So we can just get over it now.

Thanks,

tglx