x86/cpu: Adjust enable_nmis() to be shadow stack compatible
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 21 Feb 2020 17:56:57 +0000 (17:56 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 May 2020 22:09:46 +0000 (23:09 +0100)
commite952f1d67b5641bb560fbff6b80555808faf7935
tree6339daa83c4a55493a33fecb2a8054311b9f29bc
parent91d26ed304ff562f341824be12bf49bd78c39e39
x86/cpu: Adjust enable_nmis() to be shadow stack compatible

When executing an IRET-to-self, the shadow stack must agree with the regular
stack.  We can't manipulate SSP directly, so have to fake a shadow IRET frame
by executing 3 CALLs, then editing the result to look correct.

This is not a fastpath, is called on the BSP long before CET can be set up,
and may be called on the crash path after CET is disabled.  Use the fact that
INCSSP is allocated from the hint nop space to construct a test for CET being
active which is safe on all processors.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/include/asm-x86/processor.h