x86/vtx: Disable executable EPT superpages to work around CVE-2018-12207
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 20 Dec 2018 17:25:29 +0000 (17:25 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 12 Nov 2019 17:12:54 +0000 (17:12 +0000)
commit59e89cdabc71b5c3a956028ef1c439e6bae947f0
tree331be326f376eec0e8a7e9602f3dab64d6745a35
parent6dacdcd439c1ddd32110d4a008de346e367409ec
x86/vtx: Disable executable EPT superpages to work around CVE-2018-12207

CVE-2018-12207 covers a set of errata on various Intel processors, whereby a
machine check exception can be generated in a corner case when an executable
mapping changes size or cacheability without TLB invalidation.  HVM guest
kernels can trigger this to DoS the host.

To mitigate, in affected hardware, all EPT superpages are marked NX.  When an
instruction fetch violation is observed against the superpage, the superpage
is shattered to 4k and has execute permissions restored.  This prevents the
guest kernel from being able to create the necessary preconditions in the iTLB
to exploit the vulnerability.

This does come with a workload-dependent performance overhead, caused by
increased TLB pressure.  Performance can be restored, if guest kernels are
trusted not to mount an attack, by specifying ept=exec-sp on the command line.

This is part of XSA-304 / CVE-2018-12207

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
docs/misc/xen-command-line.pandoc
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/vmx/vmcs.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/mm/p2m-ept.c
xen/include/asm-x86/hvm/vmx/vmx.h
xen/include/asm-x86/msr-index.h