Repository navigation
Build with -fstack-clash-protection and -z separate-code - #123073
Conversation
`-fstack-clash-protection` probes every page of a large stack allocation so it cannot jump over a thread's guard page. `-Wl,-z,separate-code` keeps read-only data out of executable segments, removing it as a source of ROP gadgets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [6ecd3f0] Summary: ✅
AI ReviewSummaryThis PR hardens executable builds by enabling Final VerdictStatus: ✅ Approve LLVM Coverage ReportMeasured on commit 6ecd3f0.
Changed lines: Uncovered code analysis did not run: No coverable C/C++ source files changed (contrib/ is excluded from coverage). Newly covered: +169 lines in 59 files (-83 lines lost coverage) · Details |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units16117 translation units recompiled, 32786 s compile time in total, 15608 of them have a recent master baseline.
|
…ed targets Clang ignores `-fstack-clash-protection` on Darwin, WebAssembly and LoongArch, which fails the `-Werror` builds. Skip `-z separate-code` on WebAssembly. CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=123073&sha=ca5ce5576b7fed321f83f1e30fc9b779158feb15&name_0=PR Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Two more hardening flags for the binary, following PIE,
-fstack-protector-strongand full RELRO.-fstack-clash-protectionmakes the compiler touch every page of a large stack allocation, so it cannot skip past a thread's guard page into another mapping. Only functions with frames larger than a page get the extra probes.-Wl,-z,separate-codeplaces read-only data in segments that are not executable, so those bytes cannot be used as ROP gadgets. lld does not do this by default.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Build the
clickhousebinary with-fstack-clash-protectionand-Wl,-z,separate-codeto make exploiting memory bugs harder.Workflow [PR]
Sync PR [sync-upstream/pr/123073]
Version info
26.10.1.1154-master(included in26.10and later)