]> xenbits.xensource.com Git - xen.git/commit
x86/pv: Fix up erroneous segments for 32bit syscall entry
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 9 Apr 2018 09:39:32 +0000 (09:39 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 9 Apr 2018 12:12:18 +0000 (13:12 +0100)
commitdba899de14989b3dff78009404ed891da7fefdc1
tree383077a4e8c4b019d5c06ce4616c294818675047
parentf20a6e30931a92c9810ff21cfdcd85e22f12cddc
x86/pv: Fix up erroneous segments for 32bit syscall entry

The existing FLAT_KERNEL_SS expands to the correct value, 0xe02b, but is the
wrong constant to use.  Switch to FLAT_USER_SS32.

For compat domains however, the reported values are entirely bogus.
FLAT_USER_SS32 (value 0xe02b) is FLAT_RING3_CS in the 32bit ABI, while
FLAT_USER_CS32 (value 0xe023) is FLAT_RING1_DS with an RPL of 3.

The guests SYSCALL callback is invoked with a broken iret frame, and if left
unmodified by the guest, will fail on the way back out when Xen's iret tries
to load a code segment into %ss.

In practice, this is only a problem for 32bit PV guests on AMD hardware, as
Intel hardware doesn't permit the SYSCALL instruction outside of 64bit mode.

This appears to have been broken ever since 64bit support was added to Xen,
and has gone unnoticed because Linux doesn't use SYSCALL in 32bit builds.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/x86_64/compat/entry.S