Skip to content

Epic: Support Intel CET #47309

Open
Open

Description

@janvorli

Recent Intel x64 CPUs support a new security feature called CET (Control-flow Enforcement Technology). We plan to support it in the .NET 6.0.

Windows and Linux

  • Add Shadow stack popping during stack unwinding.

Windows

  • Add proper compiler and linker options to support CET for the C/C++ code.
  • Implement our own version of RtlRestoreContext for exception handling (done on Windows only for now)
  • Implement new way of thread suspension using a new user mode APC that would work the same way as on Unix.
  • Implement new way of return address hijacking compatible with the CET.
  • Make ThreadAbort work with CET enabled
  • Make GC stress 4/8 work with CET enabled
  • Enable CI for CET
  • Enable non-strict mode by default
  • Performance is comparable without CET enabled
  • Debugging support is not restricted with CET enabled

Linux

  • Add proper compiler options to enable IBT (indirect branch tracing) support and .note.gnu.property section to indicate our native runtime binaries are compatible with shadow stack and IBT.
  • Add ENDBR instructions at the beginning of asm helper functions that can be called using indirect jumps or calls.
  • Modify JIT to add ENDBR instructions at the beginning of all methods that can be called via indirect jumps or calls.
  • The Linux work depends on the availability of the CET support in the mainstream Linux kernel. There is a patch that adds some arch_prctl operations for the Intel CET.

Activity

  1. added
    os-linux
    tracking
    on Jan 22, 2021
  2. added this to the 6.0.0 milestone on Jan 22, 2021
  3. ghost added
    untriaged
    on Jan 22, 2021
  4. removed
    untriaged
    on Jan 22, 2021
  5. tannergooding commented on Jan 22, 2021

    @tannergooding
    Member

    Is the AMD shadow stack support the same as Intel CET or is it a different feature/ISA?

  6. added
    Bottom Up Work
    User Story
    on Jan 22, 2021
  7. janvorli commented on Jan 25, 2021

    @janvorli
    MemberAuthor

    @tannergooding I am not aware of AMD releasing a spec of their shadow stack technology.

  8. tannergooding commented on Jan 25, 2021

    @tannergooding
    Member

    @janvorli, AMD published it back in August (at the very least) in preparation of the Zen3 release. Most of their developer manuals can be found here: https://developer.amd.com/resources/developer-guides-manuals/

    The core information on their shadow stack support, as far as I'm aware, is in Volume 2, Chapter 18: https://www.amd.com/system/files/TechDocs/24593.pdf


    At least comparing to Intel's own manuals (https://software.intel.com/content/www/us/en/develop/download/intel-64-and-ia-32-architectures-sdm-combined-volumes-1-2a-2b-2c-2d-3a-3b-3c-3d-and-4.html), it looks like they use the same CPUID register/name: CPUID Fn0000_0007 ECX:CET_SS=1 (bit 7) and CR4.CET=1 (bit 23). It also looks like at least a handful of the instructions match, so that seems hopeful 😄

  9. mangod9 commented on Jul 29, 2021

    @mangod9
    Member

    Windows functionality is complete, but Linux will be done in 7.

  10. modified the milestones: 6.0.0, 7.0.0 on Jul 29, 2021
  11. modified the milestones: 7.0.0, Future on Aug 11, 2022
  12. moved this from UserStories + Epics to Experiments in Core-Runtime .net 10on Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bottom Up WorkUser Storyarch-x64area-Metaos-linuxos-windowstracking

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions