x86: segment attribute handling adjustments
authorJan Beulich <jbeulich@suse.com>
Fri, 20 Jan 2017 13:39:12 +0000 (14:39 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 20 Jan 2017 13:39:12 +0000 (14:39 +0100)
commit366ff5f1b3252f9069d5aedb2ffc2567bb0a37c9
treee2afab014db22d26be6c32a08c74be93a2b145be
parentf2d4f4ba80de8a03a1b0f300d271715a88a8433d
x86: segment attribute handling adjustments

Null selector loads into SS (possible in 64-bit mode only, and only in
rings other than ring 3) must not alter SS.DPL. (This was found to be
an issue on KVM, and fixed in Linux commit 33ab91103b.)

Further arch_set_info_hvm_guest() didn't make sure that the ASSERT()s
in hvm_set_segment_register() wouldn't trigger: Add further checks, but
tolerate (adjust) clear accessed (CS, SS, DS, ES) and busy (TR) bits.

Finally the setting of the accessed bits for user segments was lost by
commit dd5c85e312 ("x86/hvm: Reposition the modification of raw segment
data from the VMCB/VMCS"), yet VMX requires them to be set for usable
segments. Add respective ASSERT()s (the only path not properly setting
them was arch_set_info_hvm_guest()).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/domain.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/x86_emulate/x86_emulate.c