x86/speculation/mds: Add mds_clear_cpu_buffers()

The Microarchitectural Data Sampling (MDS) vulernabilities are mitigated by
clearing the affected CPU buffers. The mechanism for clearing the buffers
uses the unused and obsolete VERW instruction in combination with a
microcode update which triggers a CPU buffer clear when VERW is executed.

Provide a inline function with the assembly magic. The argument of the VERW
instruction must be a memory operand as documented:

  "MD_CLEAR enumerates that the memory-operand variant of VERW (for
   example, VERW m16) has been extended to also overwrite buffers affected
   by MDS. This buffer overwriting functionality is not guaranteed for the
   register operand variant of VERW."

Documentation also recommends to use a writable data segment selector:

  "The buffer overwriting occurs regardless of the result of the VERW
   permission check, as well as when the selector is null or causes a
   descriptor load segment violation. However, for lowest latency we
   recommend using a selector that indicates a valid writable data
   segment."

Add x86 specific documentation about MDS and the internal workings of the
mitigation.

Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Borislav Petkov <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Reviewed-by: Frederic Weisbecker <[email protected]>
Reviewed-by: Jon Masters <[email protected]>
Tested-by: Jon Masters <[email protected]>
This commit is contained in:
Thomas Gleixner 2019-02-18 23:13:06 +01:00
commit 6a9e529272
5 changed files with 143 additions and 0 deletions

View file

@ -101,6 +101,7 @@ implementation.
:maxdepth: 2
sh/index
x86/index
Filesystem Documentation
------------------------