]> xenbits.xensource.com Git - xen.git/commit
x86/shskt: Disable CET-SS on parts susceptible to fractured updates
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 28 Oct 2022 10:40:00 +0000 (11:40 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 9 Feb 2023 18:26:17 +0000 (18:26 +0000)
commit01e7477d1b081cff4288ff9f51ec59ee94c03ee0
treeb70eb073423bab98106ec3a5c8501994faff6f86
parentb4a23bf6293aadecfd03bf9e83974443e2eac9cb
x86/shskt: Disable CET-SS on parts susceptible to fractured updates

Refer to Intel SDM Rev 70 (Dec 2022), Vol3 17.2.3 "Supervisor Shadow Stack
Token".

Architecturally, an event delivery which starts in CPL<3 and switches shadow
stack will first validate the Supervisor Shadow Stack Token (setting the busy
bit), then pushes CS/LIP/SSP.  One example of this is an NMI interrupting Xen.

Some CPUs suffer from an issue called fracturing, whereby a fault/vmexit/etc
between setting the busy bit and completing the event injection renders the
action non-restartable, because when it comes time to restart, the busy bit is
found to be already set.

This is far more easily encountered under virt, yet it is not the fault of the
hypervisor, nor the fault of the guest kernel.  The fault lies somewhere
between the architectural specification, and the uarch behaviour.

Intel have allocated CPUID.7[1].ecx[18] CET_SSS to enumerate that supervisor
shadow stacks are safe to use.  Because of how Xen lays out its shadow stacks,
fracturing is not expected to be a problem on native.

Detect this case on boot and default to not using shstk if virtualised.
Specifying `cet=shstk` on the command line will override this heuristic and
enable shadow stacks irrespective.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
docs/misc/xen-command-line.pandoc
tools/libs/light/libxl_cpuid.c
tools/misc/xen-cpuid.c
xen/arch/x86/cpu/common.c
xen/arch/x86/setup.c
xen/include/public/arch-x86/cpufeatureset.h