Skip to content

Revert "Enable -mbranch-protection=pac-ret on ARM" - #131765

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/revert-119685
Nov 15, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/revert-119685

Conversation

@groeneai

@groeneai groeneai commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Reverts #119685

Related: #131748
Related: #119685

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Description

#119685 introduced a server crash (SIGILL on AArch64 cores without FEAT_PAuth, e.g. Graviton2, on the first SimSIMD call: an INSERT into a table with a vector_similarity index or a QBit *Transposed distance function), reported in #131748. With pac-ret, the SimSIMD CPU probe, compiled for armv8.5-a+sve, returns with retaa, which is undefined without FEAT_PAuth. The reproducer crashes at 79929b2, the first master build with #119685 (its only other change is a test file), and not at its first parent d88a8f1 (CI arm_release builds under qemu-user 11.1 -cpu neoverse-n1, 5/5 vs 0/10 runs), and still crashes on master 6ea176f. An alternative fix is open in #131762.

Proof

SIGILL at the retaa that ends _simsimd_capabilities_arm (simsimd.h:650). qemu 11.1 traps retaa without FEAT_PAuth (qemu 8.1 to 10.0 run it as ret); -cpu max has PAuth.

build -cpu INSERT QBit
79929b2 (first with #119685) neoverse-n1 5/5 5/5
d88a8f1 (first parent) neoverse-n1 0/10 0/10
6ea176f (master) neoverse-n1 5/5 5/5
79929b2 max 0/2 0/5
6ea176f max 0/1 0/2
CREATE TABLE t (id UInt64, vec Array(Float32), INDEX idx vec TYPE vector_similarity('hnsw', 'L2Distance', 2)) ENGINE = MergeTree ORDER BY id;
INSERT INTO t VALUES (1, [0., 0.]), (2, [1., 1.]);
-- or:
SELECT L2DistanceTransposed([1., 2., 3.]::QBit(Float32, 3), [1., 2., 4.], 32);

79929b2 has 6 retaa, all in SimSIMD (the probe and 5 bf16 NEON kernels); d88a8f1 has none. On this revert, contrib/SimSIMD/c/lib.c compiled with the arm_release flags has no retaa (6 with -mbranch-protection=pac-ret added).

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/131765]

Version info

  • Merged into: 26.11.1.2339-master (included in 26.11 and later)

…ranch-protection-arm"

This reverts commit 46106b1, reversing
changes made to d88a8f1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (click to expand)

Pure revert of #119685: re-applying its diff (d88a8f1234a2...46106b178ca0) to this head gives the tree of master 6ea176f exactly. Second-model review: 0 findings.

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov, could you review this? This reverts #119685, which crashes the server with SIGILL on AArch64 cores without PAuth (e.g. Graviton2) on the first SimSIMD call: the reproducer crashes at 79929b2, the first build with it, and not at its first parent d88a8f1. The fix in #131762 is the alternative.

@clickhouse-gh

clickhouse-gh Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [1577e26]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added pr-not-for-changelog This PR should not be mentioned in the changelog can be tested Allows running workflows for external contributors comp-build-system Build system (CMake, compilation, platform builds). labels Nov 15, 2026
@alexey-milovidov alexey-milovidov self-assigned this Nov 15, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 15, 2026
Merged via the queue into ClickHouse:master with commit da3abaf Nov 15, 2026
570 of 572 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 15, 2026
alexey-milovidov added a commit that referenced this pull request Nov 15, 2026
#119685 was reverted in #131765 because the `arm_release` binary died with
SIGILL on cores without `FEAT_PAuth` (Graviton2, Ampere Altra) on the first
SimSIMD call: SimSIMD compiles its CPU probe `_simsimd_capabilities_arm` and
five bf16 NEON kernels for ARMv8.3+, where clang folds `autiasp; ret` into
`retaa`, which is not in the `NOP` space.

Build `_simsimd` with `-mbranch-protection=none` (the same fix as #131762).
Compiled with the `arm_release` flags, `c/lib.c` goes from 7 `retaa` to 0.

Add a check to the `arm_release` compatibility check that scans the code
sections of the packaged binary for `retaa` and `retab` and names the
functions through `system.symbols`. A test run on Graviton3 would never notice
the next such case. On the `arm_release` package of #131745 (pac-ret on) it
reports exactly the 6 SimSIMD functions; on that of d88a8f1 (the master
commit before #119685) it passes.

Closes: #131748
Related: #131762
Related: #131765

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-build-system Build system (CMake, compilation, platform builds). pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants