144194701SPawan Gupta========================================= 244194701SPawan GuptaProcessor MMIO Stale Data Vulnerabilities 344194701SPawan Gupta========================================= 444194701SPawan Gupta 544194701SPawan GuptaProcessor MMIO Stale Data Vulnerabilities are a class of memory-mapped I/O 644194701SPawan Gupta(MMIO) vulnerabilities that can expose data. The sequences of operations for 744194701SPawan Guptaexposing data range from simple to very complex. Because most of the 844194701SPawan Guptavulnerabilities require the attacker to have access to MMIO, many environments 944194701SPawan Guptaare not affected. System environments using virtualization where MMIO access is 1044194701SPawan Guptaprovided to untrusted guests may need mitigation. These vulnerabilities are 1144194701SPawan Guptanot transient execution attacks. However, these vulnerabilities may propagate 1244194701SPawan Guptastale data into core fill buffers where the data can subsequently be inferred 1344194701SPawan Guptaby an unmitigated transient execution attack. Mitigation for these 1444194701SPawan Guptavulnerabilities includes a combination of microcode update and software 1544194701SPawan Guptachanges, depending on the platform and usage model. Some of these mitigations 1644194701SPawan Guptaare similar to those used to mitigate Microarchitectural Data Sampling (MDS) or 1744194701SPawan Guptathose used to mitigate Special Register Buffer Data Sampling (SRBDS). 1844194701SPawan Gupta 1944194701SPawan GuptaData Propagators 2044194701SPawan Gupta================ 2144194701SPawan GuptaPropagators are operations that result in stale data being copied or moved from 2244194701SPawan Guptaone microarchitectural buffer or register to another. Processor MMIO Stale Data 2344194701SPawan GuptaVulnerabilities are operations that may result in stale data being directly 2444194701SPawan Guptaread into an architectural, software-visible state or sampled from a buffer or 2544194701SPawan Guptaregister. 2644194701SPawan Gupta 2744194701SPawan GuptaFill Buffer Stale Data Propagator (FBSDP) 2844194701SPawan Gupta----------------------------------------- 2944194701SPawan GuptaStale data may propagate from fill buffers (FB) into the non-coherent portion 3044194701SPawan Guptaof the uncore on some non-coherent writes. Fill buffer propagation by itself 3144194701SPawan Guptadoes not make stale data architecturally visible. Stale data must be propagated 3244194701SPawan Guptato a location where it is subject to reading or sampling. 3344194701SPawan Gupta 3444194701SPawan GuptaSideband Stale Data Propagator (SSDP) 3544194701SPawan Gupta------------------------------------- 3644194701SPawan GuptaThe sideband stale data propagator (SSDP) is limited to the client (including 3744194701SPawan GuptaIntel Xeon server E3) uncore implementation. The sideband response buffer is 3844194701SPawan Guptashared by all client cores. For non-coherent reads that go to sideband 3944194701SPawan Guptadestinations, the uncore logic returns 64 bytes of data to the core, including 4044194701SPawan Guptaboth requested data and unrequested stale data, from a transaction buffer and 4144194701SPawan Guptathe sideband response buffer. As a result, stale data from the sideband 4244194701SPawan Guptaresponse and transaction buffers may now reside in a core fill buffer. 4344194701SPawan Gupta 4444194701SPawan GuptaPrimary Stale Data Propagator (PSDP) 4544194701SPawan Gupta------------------------------------ 4644194701SPawan GuptaThe primary stale data propagator (PSDP) is limited to the client (including 4744194701SPawan GuptaIntel Xeon server E3) uncore implementation. Similar to the sideband response 4844194701SPawan Guptabuffer, the primary response buffer is shared by all client cores. For some 4944194701SPawan Guptaprocessors, MMIO primary reads will return 64 bytes of data to the core fill 5044194701SPawan Guptabuffer including both requested data and unrequested stale data. This is 5144194701SPawan Guptasimilar to the sideband stale data propagator. 5244194701SPawan Gupta 5344194701SPawan GuptaVulnerabilities 5444194701SPawan Gupta=============== 5544194701SPawan GuptaDevice Register Partial Write (DRPW) (CVE-2022-21166) 5644194701SPawan Gupta----------------------------------------------------- 5744194701SPawan GuptaSome endpoint MMIO registers incorrectly handle writes that are smaller than 5844194701SPawan Guptathe register size. Instead of aborting the write or only copying the correct 5944194701SPawan Guptasubset of bytes (for example, 2 bytes for a 2-byte write), more bytes than 6044194701SPawan Guptaspecified by the write transaction may be written to the register. On 6144194701SPawan Guptaprocessors affected by FBSDP, this may expose stale data from the fill buffers 6244194701SPawan Guptaof the core that created the write transaction. 6344194701SPawan Gupta 6444194701SPawan GuptaShared Buffers Data Sampling (SBDS) (CVE-2022-21125) 6544194701SPawan Gupta---------------------------------------------------- 6644194701SPawan GuptaAfter propagators may have moved data around the uncore and copied stale data 6744194701SPawan Guptainto client core fill buffers, processors affected by MFBDS can leak data from 6844194701SPawan Guptathe fill buffer. It is limited to the client (including Intel Xeon server E3) 6944194701SPawan Guptauncore implementation. 7044194701SPawan Gupta 7144194701SPawan GuptaShared Buffers Data Read (SBDR) (CVE-2022-21123) 7244194701SPawan Gupta------------------------------------------------ 7344194701SPawan GuptaIt is similar to Shared Buffer Data Sampling (SBDS) except that the data is 7444194701SPawan Guptadirectly read into the architectural software-visible state. It is limited to 7544194701SPawan Guptathe client (including Intel Xeon server E3) uncore implementation. 7644194701SPawan Gupta 7744194701SPawan GuptaAffected Processors 7844194701SPawan Gupta=================== 7944194701SPawan GuptaNot all the CPUs are affected by all the variants. For instance, most 8044194701SPawan Guptaprocessors for the server market (excluding Intel Xeon E3 processors) are 8144194701SPawan Guptaimpacted by only Device Register Partial Write (DRPW). 8244194701SPawan Gupta 8344194701SPawan GuptaBelow is the list of affected Intel processors [#f1]_: 8444194701SPawan Gupta 8544194701SPawan Gupta =================== ============ ========= 8644194701SPawan Gupta Common name Family_Model Steppings 8744194701SPawan Gupta =================== ============ ========= 8844194701SPawan Gupta HASWELL_X 06_3FH 2,4 8944194701SPawan Gupta SKYLAKE_L 06_4EH 3 9044194701SPawan Gupta BROADWELL_X 06_4FH All 9144194701SPawan Gupta SKYLAKE_X 06_55H 3,4,6,7,11 9244194701SPawan Gupta BROADWELL_D 06_56H 3,4,5 9344194701SPawan Gupta SKYLAKE 06_5EH 3 9444194701SPawan Gupta ICELAKE_X 06_6AH 4,5,6 9544194701SPawan Gupta ICELAKE_D 06_6CH 1 9644194701SPawan Gupta ICELAKE_L 06_7EH 5 9744194701SPawan Gupta ATOM_TREMONT_D 06_86H All 9844194701SPawan Gupta LAKEFIELD 06_8AH 1 9944194701SPawan Gupta KABYLAKE_L 06_8EH 9 to 12 10044194701SPawan Gupta ATOM_TREMONT 06_96H 1 10144194701SPawan Gupta ATOM_TREMONT_L 06_9CH 0 10244194701SPawan Gupta KABYLAKE 06_9EH 9 to 13 10344194701SPawan Gupta COMETLAKE 06_A5H 2,3,5 10444194701SPawan Gupta COMETLAKE_L 06_A6H 0,1 10544194701SPawan Gupta ROCKETLAKE 06_A7H 1 10644194701SPawan Gupta =================== ============ ========= 10744194701SPawan Gupta 10844194701SPawan GuptaIf a CPU is in the affected processor list, but not affected by a variant, it 10944194701SPawan Guptais indicated by new bits in MSR IA32_ARCH_CAPABILITIES. As described in a later 11044194701SPawan Guptasection, mitigation largely remains the same for all the variants, i.e. to 11144194701SPawan Guptaclear the CPU fill buffers via VERW instruction. 11244194701SPawan Gupta 11344194701SPawan GuptaNew bits in MSRs 11444194701SPawan Gupta================ 11544194701SPawan GuptaNewer processors and microcode update on existing affected processors added new 11644194701SPawan Guptabits to IA32_ARCH_CAPABILITIES MSR. These bits can be used to enumerate 11744194701SPawan Guptaspecific variants of Processor MMIO Stale Data vulnerabilities and mitigation 11844194701SPawan Guptacapability. 11944194701SPawan Gupta 12044194701SPawan GuptaMSR IA32_ARCH_CAPABILITIES 12144194701SPawan Gupta-------------------------- 12244194701SPawan GuptaBit 13 - SBDR_SSDP_NO - When set, processor is not affected by either the 12344194701SPawan Gupta Shared Buffers Data Read (SBDR) vulnerability or the sideband stale 12444194701SPawan Gupta data propagator (SSDP). 12544194701SPawan GuptaBit 14 - FBSDP_NO - When set, processor is not affected by the Fill Buffer 12644194701SPawan Gupta Stale Data Propagator (FBSDP). 12744194701SPawan GuptaBit 15 - PSDP_NO - When set, processor is not affected by Primary Stale Data 12844194701SPawan Gupta Propagator (PSDP). 12944194701SPawan GuptaBit 17 - FB_CLEAR - When set, VERW instruction will overwrite CPU fill buffer 13044194701SPawan Gupta values as part of MD_CLEAR operations. Processors that do not 13144194701SPawan Gupta enumerate MDS_NO (meaning they are affected by MDS) but that do 13244194701SPawan Gupta enumerate support for both L1D_FLUSH and MD_CLEAR implicitly enumerate 13344194701SPawan Gupta FB_CLEAR as part of their MD_CLEAR support. 13444194701SPawan GuptaBit 18 - FB_CLEAR_CTRL - Processor supports read and write to MSR 13544194701SPawan Gupta IA32_MCU_OPT_CTRL[FB_CLEAR_DIS]. On such processors, the FB_CLEAR_DIS 13644194701SPawan Gupta bit can be set to cause the VERW instruction to not perform the 13744194701SPawan Gupta FB_CLEAR action. Not all processors that support FB_CLEAR will support 13844194701SPawan Gupta FB_CLEAR_CTRL. 13944194701SPawan Gupta 14044194701SPawan GuptaMSR IA32_MCU_OPT_CTRL 14144194701SPawan Gupta--------------------- 14244194701SPawan GuptaBit 3 - FB_CLEAR_DIS - When set, VERW instruction does not perform the FB_CLEAR 14344194701SPawan Guptaaction. This may be useful to reduce the performance impact of FB_CLEAR in 14444194701SPawan Guptacases where system software deems it warranted (for example, when performance 14544194701SPawan Guptais more critical, or the untrusted software has no MMIO access). Note that 14644194701SPawan GuptaFB_CLEAR_DIS has no impact on enumeration (for example, it does not change 14744194701SPawan GuptaFB_CLEAR or MD_CLEAR enumeration) and it may not be supported on all processors 14844194701SPawan Guptathat enumerate FB_CLEAR. 14944194701SPawan Gupta 15044194701SPawan GuptaMitigation 15144194701SPawan Gupta========== 15244194701SPawan GuptaLike MDS, all variants of Processor MMIO Stale Data vulnerabilities have the 15344194701SPawan Guptasame mitigation strategy to force the CPU to clear the affected buffers before 15444194701SPawan Guptaan attacker can extract the secrets. 15544194701SPawan Gupta 15644194701SPawan GuptaThis is achieved by using the otherwise unused and obsolete VERW instruction in 15744194701SPawan Guptacombination with a microcode update. The microcode clears the affected CPU 15844194701SPawan Guptabuffers when the VERW instruction is executed. 15944194701SPawan Gupta 16044194701SPawan GuptaKernel reuses the MDS function to invoke the buffer clearing: 16144194701SPawan Gupta 16244194701SPawan Gupta mds_clear_cpu_buffers() 16344194701SPawan Gupta 16444194701SPawan GuptaOn MDS affected CPUs, the kernel already invokes CPU buffer clear on 16544194701SPawan Guptakernel/userspace, hypervisor/guest and C-state (idle) transitions. No 16644194701SPawan Guptaadditional mitigation is needed on such CPUs. 16744194701SPawan Gupta 16844194701SPawan GuptaFor CPUs not affected by MDS or TAA, mitigation is needed only for the attacker 16944194701SPawan Guptawith MMIO capability. Therefore, VERW is not required for kernel/userspace. For 17044194701SPawan Guptavirtualization case, VERW is only needed at VMENTER for a guest with MMIO 17144194701SPawan Guptacapability. 17244194701SPawan Gupta 17344194701SPawan GuptaMitigation points 17444194701SPawan Gupta----------------- 17544194701SPawan GuptaReturn to user space 17644194701SPawan Gupta^^^^^^^^^^^^^^^^^^^^ 17744194701SPawan GuptaSame mitigation as MDS when affected by MDS/TAA, otherwise no mitigation 17844194701SPawan Guptaneeded. 17944194701SPawan Gupta 18044194701SPawan GuptaC-State transition 18144194701SPawan Gupta^^^^^^^^^^^^^^^^^^ 18244194701SPawan GuptaControl register writes by CPU during C-state transition can propagate data 18344194701SPawan Guptafrom fill buffer to uncore buffers. Execute VERW before C-state transition to 18444194701SPawan Guptaclear CPU fill buffers. 18544194701SPawan Gupta 18644194701SPawan GuptaGuest entry point 18744194701SPawan Gupta^^^^^^^^^^^^^^^^^ 18844194701SPawan GuptaSame mitigation as MDS when processor is also affected by MDS/TAA, otherwise 18944194701SPawan Guptaexecute VERW at VMENTER only for MMIO capable guests. On CPUs not affected by 19044194701SPawan GuptaMDS/TAA, guest without MMIO access cannot extract secrets using Processor MMIO 19144194701SPawan GuptaStale Data vulnerabilities, so there is no need to execute VERW for such guests. 19244194701SPawan Gupta 19344194701SPawan GuptaMitigation control on the kernel command line 19444194701SPawan Gupta--------------------------------------------- 19544194701SPawan GuptaThe kernel command line allows to control the Processor MMIO Stale Data 19644194701SPawan Guptamitigations at boot time with the option "mmio_stale_data=". The valid 19744194701SPawan Guptaarguments for this option are: 19844194701SPawan Gupta 19944194701SPawan Gupta ========== ================================================================= 20044194701SPawan Gupta full If the CPU is vulnerable, enable mitigation; CPU buffer clearing 20144194701SPawan Gupta on exit to userspace and when entering a VM. Idle transitions are 20244194701SPawan Gupta protected as well. It does not automatically disable SMT. 20344194701SPawan Gupta full,nosmt Same as full, with SMT disabled on vulnerable CPUs. This is the 20444194701SPawan Gupta complete mitigation. 20544194701SPawan Gupta off Disables mitigation completely. 20644194701SPawan Gupta ========== ================================================================= 20744194701SPawan Gupta 20844194701SPawan GuptaIf the CPU is affected and mmio_stale_data=off is not supplied on the kernel 20944194701SPawan Guptacommand line, then the kernel selects the appropriate mitigation. 21044194701SPawan Gupta 21144194701SPawan GuptaMitigation status information 21244194701SPawan Gupta----------------------------- 21344194701SPawan GuptaThe Linux kernel provides a sysfs interface to enumerate the current 21444194701SPawan Guptavulnerability status of the system: whether the system is vulnerable, and 21544194701SPawan Guptawhich mitigations are active. The relevant sysfs file is: 21644194701SPawan Gupta 21744194701SPawan Gupta /sys/devices/system/cpu/vulnerabilities/mmio_stale_data 21844194701SPawan Gupta 21944194701SPawan GuptaThe possible values in this file are: 22044194701SPawan Gupta 22144194701SPawan Gupta .. list-table:: 22244194701SPawan Gupta 22344194701SPawan Gupta * - 'Not affected' 22444194701SPawan Gupta - The processor is not vulnerable 22544194701SPawan Gupta * - 'Vulnerable' 22644194701SPawan Gupta - The processor is vulnerable, but no mitigation enabled 22744194701SPawan Gupta * - 'Vulnerable: Clear CPU buffers attempted, no microcode' 228*a3c12cf3STakahiro Itazuri - The processor is vulnerable but microcode is not updated. The 22944194701SPawan Gupta mitigation is enabled on a best effort basis. 230*a3c12cf3STakahiro Itazuri 231*a3c12cf3STakahiro Itazuri If the processor is vulnerable but the availability of the microcode 232*a3c12cf3STakahiro Itazuri based mitigation mechanism is not advertised via CPUID, the kernel 233*a3c12cf3STakahiro Itazuri selects a best effort mitigation mode. This mode invokes the mitigation 234*a3c12cf3STakahiro Itazuri instructions without a guarantee that they clear the CPU buffers. 235*a3c12cf3STakahiro Itazuri 236*a3c12cf3STakahiro Itazuri This is done to address virtualization scenarios where the host has the 237*a3c12cf3STakahiro Itazuri microcode update applied, but the hypervisor is not yet updated to 238*a3c12cf3STakahiro Itazuri expose the CPUID to the guest. If the host has updated microcode the 239*a3c12cf3STakahiro Itazuri protection takes effect; otherwise a few CPU cycles are wasted 240*a3c12cf3STakahiro Itazuri pointlessly. 24144194701SPawan Gupta * - 'Mitigation: Clear CPU buffers' 24244194701SPawan Gupta - The processor is vulnerable and the CPU buffer clearing mitigation is 24344194701SPawan Gupta enabled. 2447df54884SPawan Gupta * - 'Unknown: No mitigations' 2457df54884SPawan Gupta - The processor vulnerability status is unknown because it is 2467df54884SPawan Gupta out of Servicing period. Mitigation is not attempted. 2477df54884SPawan Gupta 2487df54884SPawan GuptaDefinitions: 2497df54884SPawan Gupta------------ 2507df54884SPawan Gupta 2517df54884SPawan GuptaServicing period: The process of providing functional and security updates to 2527df54884SPawan GuptaIntel processors or platforms, utilizing the Intel Platform Update (IPU) 2537df54884SPawan Guptaprocess or other similar mechanisms. 2547df54884SPawan Gupta 2557df54884SPawan GuptaEnd of Servicing Updates (ESU): ESU is the date at which Intel will no 2567df54884SPawan Guptalonger provide Servicing, such as through IPU or other similar update 2577df54884SPawan Guptaprocesses. ESU dates will typically be aligned to end of quarter. 25844194701SPawan Gupta 25944194701SPawan GuptaIf the processor is vulnerable then the following information is appended to 26044194701SPawan Guptathe above information: 26144194701SPawan Gupta 26244194701SPawan Gupta ======================== =========================================== 26344194701SPawan Gupta 'SMT vulnerable' SMT is enabled 26444194701SPawan Gupta 'SMT disabled' SMT is disabled 26544194701SPawan Gupta 'SMT Host state unknown' Kernel runs in a VM, Host SMT state unknown 26644194701SPawan Gupta ======================== =========================================== 26744194701SPawan Gupta 26844194701SPawan GuptaReferences 26944194701SPawan Gupta---------- 27044194701SPawan Gupta.. [#f1] Affected Processors 27144194701SPawan Gupta https://www.intel.com/content/www/us/en/developer/topic-technology/software-security-guidance/processors-affected-consolidated-product-cpu-model.html 272