Repository navigation
Enable fast libcxx hardening for release builds - #94757
Conversation
|
Workflow [PR], commit [9570042] Summary: ❌
|
nickitat
left a comment
There was a problem hiding this comment.
Please investigate the perf test results. We don't have to accept all slowdowns - maybe we could use PODArray in critical places or be even more creative.
|
identified a short list of clickbench tests with sustained degradations (~10-15%) so far, flame graphs are not pointing exactly where the issue is: so I've prepared a script to build a diff flame graph: https://pastila.clickhouse.com/?0013b4b5/67323b50b24e445ba18c3328c8e836b0#gtKaKkG81LWc/rAYqEOgzg==GCM |
|
profiling results: tldr:
will optimise both in separate PRs and reassess the performance impact btw, here's the script I used to automate spinning up servers, creating and populating tables, running queries, dumping traces, and generating flame graphs: https://pastila.clickhouse.com/?0013b4b5/67323b50b24e445ba18c3328c8e836b0#gtKaKkG81LWc/rAYqEOgzg==GCM |
|
|
|
| /// to the replicated column for each column in the list above. | ||
| /// If columns is not Replicated, pointer will be nullptr. | ||
| std::vector<const ColumnReplicated *> replicated_columns; | ||
| PODArray<const ColumnReplicated *> replicated_columns; |
There was a problem hiding this comment.
It would be nice if you could add a brief comment why PODArray was chosen (basically because it does no bound check whereas std::vector does due to hardening).
rschu1ze
left a comment
There was a problem hiding this comment.
I'll approve to unblock you. Didn't look at the window transform changes (am not familiar with this code) - git blame will be your friend if you like a review 😄
|
Please provide a short changelog entry and move the current PR description into a separate place |
nickitat
left a comment
There was a problem hiding this comment.
Regarding the files that required significant rewriting (especially the use of raw pointers), can we consider overriding the hardening mode on a per-TU basis?
…ng-for-release-builds
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Enable fast libcxx hardening for release builds. This is mostly needed for out-of-bounds checks. Given performance tests results, no noticeable performance impact is expected.
Documentation entry for user-facing changes
Description
In my experience, most out-of-bounds-related segfaults occur only after we go out of bounds and, as a result, they are very difficult to debug as we can't connect "pointer XYZ contained garbage and dereferencing it caused segfault" type of segfaults to concrete out-of-bounds calls. We can only hypothesize that "maybe that vector we accessed higher up in the call stack was actually empty".
Bounds checking in STL containers will make out-of-bounds crashes safe (no memory corruption) and simpler to debug:
system.crash_log-> having the crash processed by the observability bot.This is why we need to enable fast libcxx hardening for release builds. Effectively, it only enables bounds checking.
Fast mode is supposed to have very small performance impact and be suitable for production use. In Google, this resulted in only 0.3% regression and around 30% fewer segfaults. This is consistent with the performance tests results. There were a few specific workloads that saw 10-15% degradation, but that has been remediated by disabling the hardening on the per-TU basis.
Version info
26.2.1.523