x86/hvm: Disallow unknown MSR_EFER bits
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 20 Jul 2018 15:42:04 +0000 (15:42 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 24 Jul 2018 10:25:53 +0000 (11:25 +0100)
commitef0269c6215d642a709866f04ba1a1f9f13f3614
treec8f596e5527ce4adc2976ae11346b2d34485031c
parent6e2a53afa15422ee290663dbb798c085ef7068ed
x86/hvm: Disallow unknown MSR_EFER bits

It turns out that nothing ever prevented HVM guests from trying to set unknown
EFER bits.  Generally, this results in a vmentry failure.

For Intel hardware, all implemented bits are covered by the checks.

For AMD hardware, the only EFER bit which isn't covered by the checks is TCE
(which AFAICT is specific to AMD Fam15/16 hardware).  We never advertise TCE
in CPUID, but it isn't a security problem to have TCE unexpected enabled in
guest context.

Disallow the setting of bits outside of the EFER_KNOWN_MASK, which prevents
any vmentry failures for guests, yielding #GP instead.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/hvm.c