x86/entry: Make syscall/sysenter entrypoints CET-IBT compatible
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 1 Nov 2021 09:51:16 +0000 (09:51 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 25 Mar 2022 17:06:38 +0000 (17:06 +0000)
commitc253b7794b341212b2d5d3b9f3c750a93c964817
treeece79aa483ace3c3cb11f468d861de705d428ed4
parent135521e6d7bcb5ccf98f0698307df4f945ca7950
x86/entry: Make syscall/sysenter entrypoints CET-IBT compatible

Each of MSR_{L,C}STAR and MSR_SYSENTER_EIP need to land on an endbr64
instruction.  For sysenter, this is easy.

Unfortunately for syscall, the stubs are already 29 byte long with a limit of
32.  endbr64 is 4 bytes.  Luckily, there is a 1 byte instruction which can
move from the stubs into the main handlers.

Move the push %rax out of the stub and into {l,c}star_entry(), allowing room
for the endbr64 instruction when appropriate.  Update the comment describing
the entry state.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
(cherry picked from commit 17d77ec62a299f4299883ec79ab10cacafd0b2f5)
xen/arch/x86/x86_64/entry.S
xen/arch/x86/x86_64/traps.c