x86: guard against straight-line speculation past RET
authorJan Beulich <jbeulich@suse.com>
Fri, 9 Apr 2021 07:16:22 +0000 (09:16 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 9 Apr 2021 07:16:22 +0000 (09:16 +0200)
commit71b0b475d801ebeb83a6ba402425135c314fa2df
tree8cbcbf87872a9e0471617c0272fa9d527c8e491e
parent0a87e677f4f4527c439fa12a6d7fa44a28e43cb3
x86: guard against straight-line speculation past RET

Under certain conditions CPUs can speculate into the instruction stream
past a RET instruction. Guard against this just like 3b7dab93f240
("x86/spec-ctrl: Protect against CALL/JMP straight-line speculation")
did - by inserting an "INT $3" insn. It's merely the mechanics of how to
achieve this that differ: A set of macros gets introduced to post-
process RET insns issued by the compiler (or living in assembly files).

Unfortunately for clang this requires further features their built-in
assembler doesn't support: We need to be able to override insn mnemonics
produced by the compiler (which may be impossible, if internally
assembly mnemonics never get generated).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
xen/Makefile
xen/include/asm-x86/asm-defns.h