Skip to content

Do not sign return addresses in functions built for ARMv8.3 and later - #32

Merged
alexey-milovidov merged 1 commit into
ClickHouse/v6.5.15from
pac-ret-no-retaa
Nov 15, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse/v6.5.15from
pac-ret-no-retaa

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

A target of ARMv8.3 or later has FEAT_PAuth, so under -mbranch-protection=pac-ret clang folds autiasp; ret into retaa, which, unlike autiasp, is not a NOP on 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 adds branch-protection=none to 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

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

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

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.

1 participant