processor_mmio_stale_data.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. =========================================
  2. Processor MMIO Stale Data Vulnerabilities
  3. =========================================
  4. Processor MMIO Stale Data Vulnerabilities are a class of memory-mapped I/O
  5. (MMIO) vulnerabilities that can expose data. The sequences of operations for
  6. exposing data range from simple to very complex. Because most of the
  7. vulnerabilities require the attacker to have access to MMIO, many environments
  8. are not affected. System environments using virtualization where MMIO access is
  9. provided to untrusted guests may need mitigation. These vulnerabilities are
  10. not transient execution attacks. However, these vulnerabilities may propagate
  11. stale data into core fill buffers where the data can subsequently be inferred
  12. by an unmitigated transient execution attack. Mitigation for these
  13. vulnerabilities includes a combination of microcode update and software
  14. changes, depending on the platform and usage model. Some of these mitigations
  15. are similar to those used to mitigate Microarchitectural Data Sampling (MDS) or
  16. those used to mitigate Special Register Buffer Data Sampling (SRBDS).
  17. Data Propagators
  18. ================
  19. Propagators are operations that result in stale data being copied or moved from
  20. one microarchitectural buffer or register to another. Processor MMIO Stale Data
  21. Vulnerabilities are operations that may result in stale data being directly
  22. read into an architectural, software-visible state or sampled from a buffer or
  23. register.
  24. Fill Buffer Stale Data Propagator (FBSDP)
  25. -----------------------------------------
  26. Stale data may propagate from fill buffers (FB) into the non-coherent portion
  27. of the uncore on some non-coherent writes. Fill buffer propagation by itself
  28. does not make stale data architecturally visible. Stale data must be propagated
  29. to a location where it is subject to reading or sampling.
  30. Sideband Stale Data Propagator (SSDP)
  31. -------------------------------------
  32. The sideband stale data propagator (SSDP) is limited to the client (including
  33. Intel Xeon server E3) uncore implementation. The sideband response buffer is
  34. shared by all client cores. For non-coherent reads that go to sideband
  35. destinations, the uncore logic returns 64 bytes of data to the core, including
  36. both requested data and unrequested stale data, from a transaction buffer and
  37. the sideband response buffer. As a result, stale data from the sideband
  38. response and transaction buffers may now reside in a core fill buffer.
  39. Primary Stale Data Propagator (PSDP)
  40. ------------------------------------
  41. The primary stale data propagator (PSDP) is limited to the client (including
  42. Intel Xeon server E3) uncore implementation. Similar to the sideband response
  43. buffer, the primary response buffer is shared by all client cores. For some
  44. processors, MMIO primary reads will return 64 bytes of data to the core fill
  45. buffer including both requested data and unrequested stale data. This is
  46. similar to the sideband stale data propagator.
  47. Vulnerabilities
  48. ===============
  49. Device Register Partial Write (DRPW) (CVE-2022-21166)
  50. -----------------------------------------------------
  51. Some endpoint MMIO registers incorrectly handle writes that are smaller than
  52. the register size. Instead of aborting the write or only copying the correct
  53. subset of bytes (for example, 2 bytes for a 2-byte write), more bytes than
  54. specified by the write transaction may be written to the register. On
  55. processors affected by FBSDP, this may expose stale data from the fill buffers
  56. of the core that created the write transaction.
  57. Shared Buffers Data Sampling (SBDS) (CVE-2022-21125)
  58. ----------------------------------------------------
  59. After propagators may have moved data around the uncore and copied stale data
  60. into client core fill buffers, processors affected by MFBDS can leak data from
  61. the fill buffer. It is limited to the client (including Intel Xeon server E3)
  62. uncore implementation.
  63. Shared Buffers Data Read (SBDR) (CVE-2022-21123)
  64. ------------------------------------------------
  65. It is similar to Shared Buffer Data Sampling (SBDS) except that the data is
  66. directly read into the architectural software-visible state. It is limited to
  67. the client (including Intel Xeon server E3) uncore implementation.
  68. Affected Processors
  69. ===================
  70. Not all the CPUs are affected by all the variants. For instance, most
  71. processors for the server market (excluding Intel Xeon E3 processors) are
  72. impacted by only Device Register Partial Write (DRPW).
  73. Below is the list of affected Intel processors [#f1]_:
  74. =================== ============ =========
  75. Common name Family_Model Steppings
  76. =================== ============ =========
  77. HASWELL_X 06_3FH 2,4
  78. SKYLAKE_L 06_4EH 3
  79. BROADWELL_X 06_4FH All
  80. SKYLAKE_X 06_55H 3,4,6,7,11
  81. BROADWELL_D 06_56H 3,4,5
  82. SKYLAKE 06_5EH 3
  83. ICELAKE_X 06_6AH 4,5,6
  84. ICELAKE_D 06_6CH 1
  85. ICELAKE_L 06_7EH 5
  86. ATOM_TREMONT_D 06_86H All
  87. LAKEFIELD 06_8AH 1
  88. KABYLAKE_L 06_8EH 9 to 12
  89. ATOM_TREMONT 06_96H 1
  90. ATOM_TREMONT_L 06_9CH 0
  91. KABYLAKE 06_9EH 9 to 13
  92. COMETLAKE 06_A5H 2,3,5
  93. COMETLAKE_L 06_A6H 0,1
  94. ROCKETLAKE 06_A7H 1
  95. =================== ============ =========
  96. If a CPU is in the affected processor list, but not affected by a variant, it
  97. is indicated by new bits in MSR IA32_ARCH_CAPABILITIES. As described in a later
  98. section, mitigation largely remains the same for all the variants, i.e. to
  99. clear the CPU fill buffers via VERW instruction.
  100. New bits in MSRs
  101. ================
  102. Newer processors and microcode update on existing affected processors added new
  103. bits to IA32_ARCH_CAPABILITIES MSR. These bits can be used to enumerate
  104. specific variants of Processor MMIO Stale Data vulnerabilities and mitigation
  105. capability.
  106. MSR IA32_ARCH_CAPABILITIES
  107. --------------------------
  108. Bit 13 - SBDR_SSDP_NO - When set, processor is not affected by either the
  109. Shared Buffers Data Read (SBDR) vulnerability or the sideband stale
  110. data propagator (SSDP).
  111. Bit 14 - FBSDP_NO - When set, processor is not affected by the Fill Buffer
  112. Stale Data Propagator (FBSDP).
  113. Bit 15 - PSDP_NO - When set, processor is not affected by Primary Stale Data
  114. Propagator (PSDP).
  115. Bit 17 - FB_CLEAR - When set, VERW instruction will overwrite CPU fill buffer
  116. values as part of MD_CLEAR operations. Processors that do not
  117. enumerate MDS_NO (meaning they are affected by MDS) but that do
  118. enumerate support for both L1D_FLUSH and MD_CLEAR implicitly enumerate
  119. FB_CLEAR as part of their MD_CLEAR support.
  120. Bit 18 - FB_CLEAR_CTRL - Processor supports read and write to MSR
  121. IA32_MCU_OPT_CTRL[FB_CLEAR_DIS]. On such processors, the FB_CLEAR_DIS
  122. bit can be set to cause the VERW instruction to not perform the
  123. FB_CLEAR action. Not all processors that support FB_CLEAR will support
  124. FB_CLEAR_CTRL.
  125. MSR IA32_MCU_OPT_CTRL
  126. ---------------------
  127. Bit 3 - FB_CLEAR_DIS - When set, VERW instruction does not perform the FB_CLEAR
  128. action. This may be useful to reduce the performance impact of FB_CLEAR in
  129. cases where system software deems it warranted (for example, when performance
  130. is more critical, or the untrusted software has no MMIO access). Note that
  131. FB_CLEAR_DIS has no impact on enumeration (for example, it does not change
  132. FB_CLEAR or MD_CLEAR enumeration) and it may not be supported on all processors
  133. that enumerate FB_CLEAR.
  134. Mitigation
  135. ==========
  136. Like MDS, all variants of Processor MMIO Stale Data vulnerabilities have the
  137. same mitigation strategy to force the CPU to clear the affected buffers before
  138. an attacker can extract the secrets.
  139. This is achieved by using the otherwise unused and obsolete VERW instruction in
  140. combination with a microcode update. The microcode clears the affected CPU
  141. buffers when the VERW instruction is executed.
  142. Kernel does the buffer clearing with x86_clear_cpu_buffers().
  143. On MDS affected CPUs, the kernel already invokes CPU buffer clear on
  144. kernel/userspace, hypervisor/guest and C-state (idle) transitions. No
  145. additional mitigation is needed on such CPUs.
  146. For CPUs not affected by MDS or TAA, mitigation is needed only for the attacker
  147. with MMIO capability. Therefore, VERW is not required for kernel/userspace. For
  148. virtualization case, VERW is only needed at VMENTER for a guest with MMIO
  149. capability.
  150. Mitigation points
  151. -----------------
  152. Return to user space
  153. ^^^^^^^^^^^^^^^^^^^^
  154. Same mitigation as MDS when affected by MDS/TAA, otherwise no mitigation
  155. needed.
  156. C-State transition
  157. ^^^^^^^^^^^^^^^^^^
  158. Control register writes by CPU during C-state transition can propagate data
  159. from fill buffer to uncore buffers. Execute VERW before C-state transition to
  160. clear CPU fill buffers.
  161. Guest entry point
  162. ^^^^^^^^^^^^^^^^^
  163. Same mitigation as MDS when processor is also affected by MDS/TAA, otherwise
  164. execute VERW at VMENTER only for MMIO capable guests. On CPUs not affected by
  165. MDS/TAA, guest without MMIO access cannot extract secrets using Processor MMIO
  166. Stale Data vulnerabilities, so there is no need to execute VERW for such guests.
  167. Mitigation control on the kernel command line
  168. ---------------------------------------------
  169. The kernel command line allows to control the Processor MMIO Stale Data
  170. mitigations at boot time with the option "mmio_stale_data=". The valid
  171. arguments for this option are:
  172. ========== =================================================================
  173. full If the CPU is vulnerable, enable mitigation; CPU buffer clearing
  174. on exit to userspace and when entering a VM. Idle transitions are
  175. protected as well. It does not automatically disable SMT.
  176. full,nosmt Same as full, with SMT disabled on vulnerable CPUs. This is the
  177. complete mitigation.
  178. off Disables mitigation completely.
  179. ========== =================================================================
  180. If the CPU is affected and mmio_stale_data=off is not supplied on the kernel
  181. command line, then the kernel selects the appropriate mitigation.
  182. Mitigation status information
  183. -----------------------------
  184. The Linux kernel provides a sysfs interface to enumerate the current
  185. vulnerability status of the system: whether the system is vulnerable, and
  186. which mitigations are active. The relevant sysfs file is:
  187. /sys/devices/system/cpu/vulnerabilities/mmio_stale_data
  188. The possible values in this file are:
  189. .. list-table::
  190. * - 'Not affected'
  191. - The processor is not vulnerable
  192. * - 'Vulnerable'
  193. - The processor is vulnerable, but no mitigation enabled
  194. * - 'Vulnerable: Clear CPU buffers attempted, no microcode'
  195. - The processor is vulnerable but microcode is not updated. The
  196. mitigation is enabled on a best effort basis.
  197. If the processor is vulnerable but the availability of the microcode
  198. based mitigation mechanism is not advertised via CPUID, the kernel
  199. selects a best effort mitigation mode. This mode invokes the mitigation
  200. instructions without a guarantee that they clear the CPU buffers.
  201. This is done to address virtualization scenarios where the host has the
  202. microcode update applied, but the hypervisor is not yet updated to
  203. expose the CPUID to the guest. If the host has updated microcode the
  204. protection takes effect; otherwise a few CPU cycles are wasted
  205. pointlessly.
  206. * - 'Mitigation: Clear CPU buffers'
  207. - The processor is vulnerable and the CPU buffer clearing mitigation is
  208. enabled.
  209. * - 'Unknown: No mitigations'
  210. - The processor vulnerability status is unknown because it is
  211. out of Servicing period. Mitigation is not attempted.
  212. Definitions:
  213. ------------
  214. Servicing period: The process of providing functional and security updates to
  215. Intel processors or platforms, utilizing the Intel Platform Update (IPU)
  216. process or other similar mechanisms.
  217. End of Servicing Updates (ESU): ESU is the date at which Intel will no
  218. longer provide Servicing, such as through IPU or other similar update
  219. processes. ESU dates will typically be aligned to end of quarter.
  220. If the processor is vulnerable then the following information is appended to
  221. the above information:
  222. ======================== ===========================================
  223. 'SMT vulnerable' SMT is enabled
  224. 'SMT disabled' SMT is disabled
  225. 'SMT Host state unknown' Kernel runs in a VM, Host SMT state unknown
  226. ======================== ===========================================
  227. References
  228. ----------
  229. .. [#f1] Affected Processors
  230. https://www.intel.com/content/www/us/en/developer/topic-technology/software-security-guidance/processors-affected-consolidated-product-cpu-model.html