Repository navigation
Do not sign return addresses in functions built for ARMv8.3 and later - #32
Merged
Merged
Conversation
A target of ARMv8.3 or later has `FEAT_PAuth`, so under `-mbranch-protection=pac-ret` the compiler folds `autiasp; ret` into `retaa`. Unlike `paciasp` and `autiasp`, `retaa` is not in the `NOP` space and raises SIGILL on cores without `FEAT_PAuth` (Graviton2, Ampere Altra). One of these functions is the CPU probe `_simsimd_capabilities_arm` (`arch=armv8.5-a+sve`), which runs on every core; the others are the bf16 kernels (`arch=armv8.6-a+...`). Add `branch-protection=none` to these targets only. The code for ARMv8.2 and older keeps the signing: a callee whose branch protection differs from the caller's is not inlined, and with ThinLTO that broke `vectorize(enable)` loops calling `simsimd_bf16_to_f32`. See ClickHouse/ClickHouse#131748
This was referenced Nov 15, 2026
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A target of ARMv8.3 or later has
FEAT_PAuth, so under-mbranch-protection=pac-retclang foldsautiasp; retintoretaa, which, unlikeautiasp, is not aNOPon older cores and raises SIGILL there (Graviton2, Ampere Altra). One such function is the CPU probe_simsimd_capabilities_arm(arch=armv8.5-a+sve); the others are the bf16 kernels (arch=armv8.6-a+...). This addsbranch-protection=noneto those targets only; ARMv8.2 code keeps signing, so (Thin)LTO can still inline it into signed callers.Based on e81e1c2 (the commit ClickHouse pins); it touches only headers, so it does not overlap with #30.
Related: ClickHouse/ClickHouse#131748
Related: ClickHouse/ClickHouse#131784
🤖 Generated with Claude Code