Linux's Speculation Handling Was Messed Up After Resuming From Suspend For Boot CPU
Written by Michael Larabel in Linux Security on 5 April 2022 at 07:36 PM EDT. 6 Comments
LINUX SECURITY --
Hitting the mainline Linux Git tree today was a rather interesting fix... It turns out that when Linux was resuming from S3 suspend, it wasn't correctly restoring the MSRs for the boot CPU around handling speculative execution mitigations.

The Linux kernel was not restoring speculation-related model specific registers (MSRs) for the boot CPU when resuming from S3 suspend. These model specific registers are important for mitigating speculative execution vulnerabilities but unfortunately the x86 power code wasn't restoring their intended state on resume. In turn this could leave the boot CPU vulnerable (though secondary CPUs were correctly restored) after suspending the Linux system. At least with only the boot CPU not being covered, the exposure is limited but still surprising the issue was only uncovered and addressed now in 2022 after all the attention these speculative execution vulnerability mitigations have received the past few years.


Whoops!


The fix makes use of the Linux framework for saving/restoring extra MSR registers around the suspend/resume cycle. MSRs not previously handled correctly until this fix included MSR_IA32_SPEC_CTRL for speculation control, MSR_IA32_TSX_CTRL and MSR_TSX_FORCE_ABORT for the TSX Async Abort (TAA) vulnerability, MSR_IA32_MCU_OPT_CTRL for the Special Register Buffer Data Sampling around the Microarchitectural Data Sampling (MDS) vulnerability, and MSR_AMD64_LS_CFG.

While hitting Linux 5.18 Git today, the fix by Intel engineer Pawan Gupta is also marked for back-porting to currently supported Linux stable series.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week