x86/hvm: Disallow unknown MSR_EFER bits
PATCH 1/1 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.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Sergey Dyasli <[email protected]>
Note: On AMD hardware, bits 7:1 are Reserved write-discard rather than yielding #GP. Implementing this doesn't seem worthwhile (no software will try to set these bits, because they are strictly reserved on Intel hardware), and would require rather more complicated changes to hvm_efer_valid() to feed back a modified efer value.
--- xen/arch/x86/hvm/hvm.c | 3 +++ 1 file changed, 3 insertions(+)
xen/arch/x86/hvm/hvm.c +3 -0
@@ -907,6 +907,9 @@ const char *hvm_efer_valid(const struct vcpu *v, uint64_t value,else p = &host_cpuid_policy; +if ( value & ~EFER_KNOWN_MASK ) +return "Unknown bits set" ; +if ( (value &EFER_SCE ) && !p->extd.syscall )return "SCE without feature" ;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Andrew Cooper
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.
Quoted 4 lines
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 <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Andrew Cooper
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.
Quoted 4 lines
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 <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Jan Beulich
Acked-byQuoted 13 lines
Quoted 1 line
Quoted 1 line · On 23.07.18 at 16:11, <[email protected]> wrote:
Quoted 1 line · Andrew Cooper
It turns out that nothing ever prevented HVM guests from trying to set
unknown
Quoted 9 lines
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.
Quoted 6 lines
Quoted 4 lines
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 <[email protected]>Reviewed-by Roger Pau Monné <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel