Skip to content

Add x86_64 Shadow Stack support for Linux #154820

Description

@submachine

Feature or enhancement

Proposal:

This issue proposes adding Shadow Stack support to cpython builds for x86_64 on Linux.

Shadow Stacks are a hardware-enforced security feature that maintains a separate, tamper proof list of return addresses to protect against Return-Oriented Programming style exploits. Shadow Stack hardware support is available on Intel 11th Generation and newer CPUs, and AMD Zen3 and newer CPUs. It is supported by both GCC (8.1+) and LLVM (7.0.0+) since 2018. On CPUs that do not support this feature, or systems where glibc does not enable it by default, compatible binaries run without any performance cost. As of today, no major Linux distribution enables shadow stack protection by default although some do build packages with support for it.

Fedora has been building its packages with CET support (which includes Shadow Stack, and additionally Indirect Branch Tracking) since 2018, i.e. Fedora 28, and Ubuntu since 24.04.

We are working on enabling Shadow Stack by default in Fedora (https://fedoraproject.org/wiki/Changes/ShadowStack). Once complete, the change would mean that Fedora enforces Shadow Stack protection at runtime for applications that support it.

The proposal is to add -fcf-protection=return (shstk-only, no IBT) to cpython's BASECFLAGS in configure.ac for the x86_64-linux-gnu platform triplet so that the interpreter, stdlib, and third-party extensions built against it are compiled with Shadow Stack support.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions