Skip to content

Consider disabling LVI mitigations in the x86_64-fortanix-unknown-sgx target #108414

Open
@clauverjat

Description

@clauverjat

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

  1. https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/resources/processors-affected-load-value-injection.html

  2. https://www.phoronix.com/review/lvi-attack-perf

  3. https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00598.html

  4. https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/branch-history-injection.html

  5. https://www.phoronix.com/news/LLVM-Retpoline-Added

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-securityArea: Security (example: address space layout randomization).A-target-featureArea: Enabling/disabling target features like AVX, Neon, etc.A-target-specsArea: Compile-target specificationsO-SGXTarget: SGXO-x86_64Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions