]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commit
x86emul: correct put_fpu()'s segment selector handling
authorJan Beulich <jbeulich@suse.com>
Wed, 8 Jan 2025 10:02:16 +0000 (11:02 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 8 Jan 2025 10:02:16 +0000 (11:02 +0100)
commit645b8d48c78f5b6ffd6230873f9e3ced4e840acd
tree20745f5eaaaee3fa4113747239d52c99b36703a6
parentd3709d1324aa140f064b9c68da37547f459f8e8d
x86emul: correct put_fpu()'s segment selector handling

All selector fields under ctxt->regs are (normally) poisoned in the HVM
case, and the four ones besides CS and SS are potentially stale for PV.
Avoid using them in the hypervisor incarnation of the emulator, when
trying to cover for a missing ->read_segment() hook.

To make sure there's always a valid ->read_segment() handler for all HVM
cases, add a respective function to shadow code, even if it is not
expected for FPU insns to be used to update page tables.

Fixes: 0711b59b858a ("x86emul: correct FPU code/data pointers and opcode handling")
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/mm/shadow/hvm.c
xen/arch/x86/x86_emulate/x86_emulate.c