Description
The x86_64-fortanix-unknown-sgx target currently has Load Value Injection (LVI) mitigations enabled by default. These mitigations were introduced by #72655. At the time, these software mitigations were necessary on all Intel hardware to protect against the LVI vulnerability (CVE-2020-0551). Recent CPUs (such as Icelake and newer) now have hardware-level protections against LVI 1, which makes the software-based mitigations unnecessary.
Since LVI software mitigations can result in significant performance overheads (2x to 19x slowdown factor)2, it would be preferable to make these mitigations opt-in rather than enabled by default.
That being said the situation regarding speculative execution vulnerabilities is not simple. The LVI mitigations that we have enabled today might give us protection against other speculative attacks. So before removing the LVI mitigations, it's important to investigate whether we need software-based mitigations against other speculative execution attacks. For example, I saw that recent CPUs are vulnerable to Branch History Injection (BHI) and Intra-Mode BTI vulnerabilities3. Those vulnerabilities are of the Spectre variant 2 kind. Those are usually mitigated with retpolines on x86 platforms, so we should consider using target-feature=+retpoline
. Intel's technical documentation provides some recommendations4. It's worth noting that retpolines are much lighter than LVI mitigations, typically resulting only in a 5-10% overhead5.
Thus, if we just need this mitigation on modern CPUs, this will already be a big performance win.
@jethrogb @raoulstrackx : what do you think ?
Footnotes
-
https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/resources/processors-affected-load-value-injection.html ↩
-
https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00598.html ↩
-
https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/branch-history-injection.html ↩