Skip to content

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

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

Algunenano merged 4 commits into
ClickHouse/release-22.xfrom
cfi-fixes-22.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.

cc @thevar1able

Algunenano and others added 4 commits November 12, 2026 16:35
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 7368996 into ClickHouse/release-22.x Nov 12, 2026
12 checks passed
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