]> xenbits.xensource.com Git - xen.git/commit
x86/entry: Organise the clobbering of the RSB/RAS on entry to Xen
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 8 Feb 2018 11:29:28 +0000 (12:29 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 8 Feb 2018 11:29:28 +0000 (12:29 +0100)
commita24b7553f92517b3d81cad1ad4798ef74b42055b
tree433ba8fec8fa62b671a7211551cd2d6946d4df88
parent13a30ba54caa1b33f707137279d27d5cd39e8844
x86/entry: Organise the clobbering of the RSB/RAS on entry to Xen

ret instructions are speculated directly to values recorded in the Return
Stack Buffer/Return Address Stack, as there is no uncertainty in well-formed
code.  Guests can take advantage of this in two ways:

  1) If they can find a path in Xen which executes more ret instructions than
     call instructions.  (At least one in the waitqueue infrastructure,
     probably others.)

  2) Use the fact that the RSB/RAS in hardware is actually a circular stack
     without a concept of empty.  (When it logically empties, stale values
     will start being used.)

To mitigate, overwrite the RSB on entry to Xen with gadgets which will capture
and contain rogue speculation.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: e6c0128e9ab25bf66df11377a33ee5584d7f99e3
master date: 2018-01-26 14:10:21 +0000
xen/include/asm-x86/cpufeatures.h
xen/include/asm-x86/nops.h
xen/include/asm-x86/spec_ctrl_asm.h