x86/cet: Force -fno-jump-tables for CET-IBT
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 7 Mar 2022 12:34:48 +0000 (12:34 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 7 Mar 2022 14:13:01 +0000 (14:13 +0000)
commit9d4a44380d273de22d5753883cbf5581795ff24d
tree659be8263461f1e8122cca512d5657fd6677464e
parent4cb8d7a06752b368a365e30117f535a2fdad3963
x86/cet: Force -fno-jump-tables for CET-IBT

Both GCC and Clang have a (mis)feature where, even with
-fcf-protection=branch, jump tables are created using a notrack jump rather
than using endbr's in each case statement.

This is incompatible with the safety properties we want in Xen, and enforced
by not setting MSR_S_CET.NOTRACK_EN.  The consequence is a fatal #CP[endbr].

-fno-jump-tables is generally active as a side effect of
CONFIG_INDIRECT_THUNK (retpoline), but as of c/s 95d9ab461436 ("x86/Kconfig:
introduce option to select retpoline usage"), we explicitly support turning
retpoline off.

Fixes: 3667f7f8f7c4 ("x86: Introduce support for CET-IBT")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/arch.mk