Repository navigation
Leave the SanitizerCoverage PC table out of the fuzzer build - #123738
Conversation
`Build (amd_fuzzers)` on master fails again at the link step of `clickhouse_fuzzer`, starting with 4127c65 (#121371): ld.lld-22: error: .../libclang_rt_asan.a(sanitizer_stackdepot.cpp.o):(function __sanitizer::(anonymous namespace)::CompressThread::NewWorkNotify(): .text+0x19e): relocation R_X86_64_PC32 out of range: 2148873898 is not in [-2147483648, 2147483647]; references section '.bss' This is the same overflow as in e56a18c: the image sits right at the 2 GiB reach of the small code model, and any commit can tip it over. Shaving a few MiB again would only postpone the next failure, so remove the largest thing in that range that the fuzzers do not need. `-fsanitize=fuzzer-no-link` implies `-fsanitize-coverage=pc-table`, which emits 16 bytes per instrumented edge into `__sancov_pcs`. It is a writable section, so `lld` places it between `.text` and `.bss`. Measured on `KeyCondition.cpp`, `InterpreterSelectQuery.cpp` and `FunctionsConversion.cpp` compiled with the CI flags, it is 20-25% of the instrumented `.text`, i.e. several hundred MiB for the whole image. With `-fno-sanitize-coverage=pc-table` the `.text` and `__sancov_cntrs` are unchanged and `__sancov_pcs` is gone. libFuzzer gets coverage feedback from the inline 8-bit counters; the PC table only serves reporting (`cov:` in the progress lines, `NEW_FUNC`, `-print_pcs`, `-print_coverage`, `-print_funcs`) and `-focus_function`, none of which CI uses. `ft:` stays in the progress lines, and the report in `libfuzzer_test_check.py` already treats `cov` as optional. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=501d978d7b9daa2036adbf79f930fae5db42219c&name_0=MasterCI&name_1=Build%20%28amd_fuzzers%29 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [bcd494c] Summary: ⏳
AI ReviewSummaryThis PR appends Final Verdict
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline. |
| get_target_property(target_compile_options ${target} COMPILE_OPTIONS) | ||
| if (NOT target_compile_options MATCHES "-fno-sanitize=all") | ||
| target_compile_options(${target} PRIVATE "-fsanitize=fuzzer-no-link") | ||
| target_compile_options(${target} PRIVATE "-fsanitize=fuzzer-no-link" "-fno-sanitize-coverage=pc-table") |
There was a problem hiding this comment.
We can also exclude some libraries from instrumentation (especially big ones, for which we already even disable debug symbols)
There was a problem hiding this comment.
🕵 Good idea, and it would add headroom. I'd keep it as a separate follow-up, though. Excluding a library from -fsanitize=fuzzer-no-link also removes its coverage counters, so libFuzzer can't guide inputs through that code anymore. That trade-off depends on which libraries the fuzzers actually exercise (for example, the big contrib ones like aws, grpc, and arrow are probably safe to drop, while the src/ libraries are not). This PR removes only the PC table, which libFuzzer doesn't use for guidance, so fuzzing behaviour stays the same.
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=123738&sha=latest&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%201%2F2%29 ( The other failures are also unrelated to this CMake-only fuzzer change, and they already have fixes in progress: |
|
The fix is in progress: #123774. The Replicated DDL replay qualified |
We'll do both and merge as soon as they are green. (The master is blocked; right now, we can merge only already tested PRs. I've also considered trimming the fuzzer build. We can also: - speed-up CI for "blocker" PRs by omitting most of the checks; - I can merge this change to all my pending PRs so they can merge sooner. |
Related: #119039
Related: #121371
Build (amd_fuzzers)has failed on master since 4127c65. It fails at the link step ofclickhouse_fuzzer:CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=501d978d7b9daa2036adbf79f930fae5db42219c&name_0=MasterCI&name_1=Build%20%28amd_fuzzers%29
This is the same overflow as in #119039. The image sits right at the 2 GiB reach of the small code model, so any commit can tip it over (here #121371 did). Shaving another few MiB would only postpone the next failure. Instead, this removes the largest thing in that range that the fuzzers don't need.
-fsanitize=fuzzer-no-linkimplies-fsanitize-coverage=pc-table, which emits 16 bytes per instrumented edge into__sancov_pcs. That section is writable, solldplaces it between.textand.bss. I compiledKeyCondition.cpp,InterpreterSelectQuery.cppandFunctionsConversion.cppwith the CI flags. The table is 20-25% of the instrumented.text, which should be several hundred MiB for the whole image. With-fno-sanitize-coverage=pc-table,.textand__sancov_cntrsstay the same and__sancov_pcsis gone.libFuzzer gets its coverage feedback from the inline 8-bit counters. The PC table only serves reporting (
cov:in the progress lines,NEW_FUNC,-print_pcs,-print_coverage,-print_funcs) and-focus_function, and CI uses none of these.ft:stays in the progress lines, andlibfuzzer_test_check.pyalready treatscovas optional.PIC/PIE doesn't help here because the build already uses both: x86-64 PIC still reaches data with 32-bit RIP-relative relocations.
-mcmodel=largewould remove the limit, but it would have to cover every object in the image, including Rust crates and sanitizer runtimes, and it makes the code larger and slower.Changelog category (leave one):
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/123738]
Version info
26.10.1.1477-master(included in26.10and later)