x86emul: honor guest CR0.TS and CR0.EM
authorJan Beulich <jbeulich@suse.com>
Tue, 4 Oct 2016 13:04:46 +0000 (14:04 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 4 Oct 2016 13:04:46 +0000 (14:04 +0100)
commit3ab81e01104d7c05e239f3bd9329c4fc87a463f4
tree4746ba49daa0b8d4493134a415afb13888294e36
parentd1fd8b09de4bb7e82573b816ba0434d62db28239
x86emul: honor guest CR0.TS and CR0.EM

We must not emulate any instructions accessing respective registers
when either of these flags is set in the guest view of the register, or
else we may do so on data not belonging to the guest's current task.

Being architecturally required behavior, the logic gets placed in the
instruction emulator instead of hvmemul_get_fpu(). It should be noted,
though, that hvmemul_get_fpu() being the only current handler for the
get_fpu() callback, we don't have an active problem with CR4: Both
CR4.OSFXSR and CR4.OSXSAVE get handled as necessary by that function.

This is XSA-190.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/tests/x86_emulator/test_x86_emulator.c
xen/arch/x86/hvm/emulate.c
xen/arch/x86/x86_emulate/x86_emulate.c
xen/arch/x86/x86_emulate/x86_emulate.h