Thanks to visit codestin.com
Credit goes to github.com

Skip to content

asm_trampoline.S misses BTI/PAC protection flags for aarch64 #139808

Description

@stratakis

Bug report

Bug description:

asm_trampoline.S added here 6d791a9 misses the BTI/PAC protections offered for the latest aarch64 processors when using the -mbranch-protection=<protection> flag.

For C code the compiler takes care of that, however for the assembler files the relevant instructions need to be added manually.

This was discovered by running the annobin-annocheck tool on a Fedora machine:

$ annocheck --hardened libpython3.14.so.1.0

annocheck 'hardened' test fails for /usr/lib64/libpython3.14.so.1.0 on aarch64 dynamic-tags test because the BTI_PLT flag is missing from the dynamic tags

property-note test because properly formatted .note.gnu.property not found (it is needed for branch protection support)

When the protections are there, the binary/library should read:

$ readelf -n libpython3.14.so.1.0 | grep Properties
Properties: AArch64 feature: BTI, PAC

While adding the instructions is simple enough, more complexity arises due to Perf requiring to work without frame pointers from 3.13+.

Relevant documentation: https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/enabling-pac-and-bti-on-aarch64

CPython versions tested on:

CPython main branch, 3.15, 3.14, 3.13, 3.12

Operating systems tested on:

Linux

Linked PRs

Activity

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

    3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions