Skip to content

Fix Clang CFI failures in libunwind, libcxxabi, LLVM and XRay - #152

Merged
Algunenano merged 4 commits into
ClickHouse/release-23.xfrom
cfi-fixes-23.x
Nov 13, 2026
Merged

Algunenano merged 4 commits into
ClickHouse/release-23.xfrom
cfi-fixes-23.x

Conversation

@Algunenano

Copy link
Copy Markdown
Member

Fixes for building with Clang CFI: construct objects in raw storage instead of casting it first, exempt the few calls whose target cannot have a CFI type (personality routines, thread_local destructors, whose pointers are now mangled as glibc does), and keep the XRay handler pointers read-only.

Same fixes as #151, for release-23.x.

cc @thevar1able

Algunenano and others added 4 commits November 12, 2026 16:39
Construct the cursor in its raw buffer, which cfi-unrelated-cast rejects casting first, and call the personality routine, which may have no CFI type (for example Rust's), without the cfi-icall check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clang emits no CFI type for destructors, so the call cannot be checked by cfi-icall. Keep the pointers mangled with a per-process secret, as glibc does for this list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
It returns memory that holds no T yet, like the libc++ functions marked _LIBCPP_NO_CFI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The trampolines call the handlers without any check, so keep each pointer on a read-only page that is made writable only while it is set.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Algunenano
Algunenano merged commit 4117d75 into ClickHouse/release-23.x Nov 13, 2026
13 checks passed
lazerg pushed a commit to lazerg/ClickHouse that referenced this pull request Nov 17, 2026
`AArch64TargetMachine` constructor writes the process-global `LLT::ExtendedLLT`
flag, which raced with `CHJIT` instances created concurrently on other threads
(ThreadSanitizer report in `Stress test (arm_tsan)`). The fork now makes the
flag a relaxed `std::atomic<bool>`.

The update also brings the Clang CFI fixes from the fork
(ClickHouse/llvm-project#152).

Related: ClickHouse/llvm-project#154
Related: ClickHouse#117346
Related: llvm/llvm-project#219517

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant