Repository navigation
Keep ARMv8.3+ code out of SimSIMD instead of disabling branch protection - #33
Merged
Merged
Conversation
The previous fix (#32) added `branch-protection=none` to the targets of ARMv8.3 and later, because in such functions the compiler folds `autiasp; ret` into `retaa`, which raises SIGILL on cores without `FEAT_PAuth` (Graviton2, Ampere Altra). That left these functions without return address signing. Fix the root cause instead: - `_simsimd_capabilities_arm` was compiled for `arch=armv8.5-a+sve` only so that the assembler accepts `mrs ..., ID_AA64ZFR0_EL1`. Read the register by its encoding `S3_0_C0_C4_4` and drop the `target` block. - The bf16 kernels only need the features, not the architecture bump: use `+simd+bf16` and `+sve+sve2+bf16` instead of `arch=armv8.6-a+...`. All functions are signed again under `-mbranch-protection=pac-ret`, and the ClickHouse binary contains no `retaa`/`retab` or other non-`HINT` PAuth instructions. Verified on Neoverse N1 (Graviton2) and Neoverse V2. See ClickHouse/ClickHouse#131748 Related: #32 Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov
pushed a commit
to groeneai/ClickHouse
that referenced
this pull request
Nov 17, 2026
…h protection Bumps `contrib/SimSIMD` to the merge of ClickHouse/SimSIMD#33. The CPU probe `_simsimd_capabilities_arm` reads `ID_AA64ZFR0_EL1` by its encoding instead of being compiled for `arch=armv8.5-a+sve`, and the bf16 kernels use `+simd+bf16` / `+sve+sve2+bf16` instead of `arch=armv8.6-a+...`. Nothing in `SimSIMD` is compiled for ARMv8.3 or later anymore, so it no longer needs `branch-protection=none` and all of its functions are signed under `-mbranch-protection=pac-ret`, without `retaa` that would raise SIGILL on cores without `FEAT_PAuth`. The bump also brings ClickHouse/SimSIMD#30 (typed kernel dispatch). Related: ClickHouse/SimSIMD#33 Related: ClickHouse#131748 Related: ClickHouse#131784 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
#32 avoided
retaa(SIGILL on cores withoutFEAT_PAuth, such as Graviton2 and Ampere Altra) by addingbranch-protection=noneto the ARMv8.3+ targets, which left those functions unsigned under-mbranch-protection=pac-ret. This fixes the root cause instead, so that every function stays signed:_simsimd_capabilities_armwas compiled forarch=armv8.5-a+sveonly so that the assembler acceptsmrs ..., ID_AA64ZFR0_EL1. It now reads the register by its encoding,S3_0_C0_C4_4, and thetargetblock is gone.+simd+bf16and+sve+sve2+bf16replacearch=armv8.6-a+....Verification with ClickHouse master plus this change:
c/lib.c: with thearm_releaseflags it has 0retaaand 104 signed functions (with Do not sign return addresses in functions built for ARMv8.3 and later #32 it had 102 of 109 signed).arm_release): it links without-Wpass-failed. A full disassembly finds noretaa/retaband no other PAuth instruction outside theHINTspace.bf16HNSW vector index,cosineDistance/L2Distance, stack traces and the query profiler. A control binary containingretaadies with SIGILL on the same machine.S3_0_C0_C4_4.Related: ClickHouse/ClickHouse#131748
Related: ClickHouse/ClickHouse#131784
Related: #32
Related: https://github.com/ClickHouse/clickhouse-private/issues/86596#issuecomment-6913945178
🤖 Generated with Claude Code