Skip to content

Conversation

zaydr-al
Copy link

Add BTI hint + GNU property to fcontext trampolines

The AArch64 fcontext trampolines (jump_fcontext, make_fcontext, ontop_fcontext) are indirect-entry-points. On BTI-enforcing systems they must begin with a BTI or the first resume can trap with SIGILL.

Insert bti c (hint #34) at each entry under __ARM_FEATURE_BTI_DEFAULT, and emit GNU_PROPERTY_AARCH64_FEATURE_1_BTI from each AArch64 assembly file so linkers map the DSO with PROT_BTI.

Scope: ELF/GAS AArch64 trampolines only; +4 bytes per entry

Fixes #308

Notes

  • This change is orthogonal to the separate LLVM landing-pad bti j issue #149267; exception paths built with affected Clang toolchains will still require the upstream fix.

…LF/GAS)

The AArch64 fcontext trampolines (jump_fcontext, make_fcontext, ontop_fcontext)
are indirect-entry-points. On BTI-enforcing systems they must begin with a BTI
or the first resume can trap with SIGILL.

Insert `bti c` (hint boostorg#34) at each entry under `__ARM_FEATURE_BTI_DEFAULT`, and
emit `GNU_PROPERTY_AARCH64_FEATURE_1_BTI` from each AArch64 assembly file so
linkers map the DSO with PROT_BTI without requiring -z force-bti.

Scope: ELF/GAS AArch64 trampolines only; +4 bytes per entry

Fixes boostorg#308
@olk
Copy link
Member

olk commented Aug 17, 2025

Did you successfully run the unit tests?

@zaydr-al
Copy link
Author

I ran libs/context/test on AL2023/Graviton after a clean build: all tests pass on GCC. With clang-15 they also pass when linking against libgcc.
Happy to attach logs if helpful.

@olk olk self-requested a review August 24, 2025 17:47
@olk olk merged commit e9a7b96 into boostorg:develop Aug 26, 2025
19 of 23 checks passed
@olk
Copy link
Member

olk commented Aug 26, 2025

ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AArch64: add BTI hint to *fcontext trampolines - fixes BTI crash on Graviton4
3 participants