Skip to content

Do not print runtime addresses in fatal error reports - #126039

Merged
Algunenano merged 2 commits into
ClickHouse:masterfrom
Algunenano:hide-raw-addresses-in-fatal-reports
Oct 16, 2026
Merged

Algunenano merged 2 commits into
ClickHouse:masterfrom
Algunenano:hide-raw-addresses-in-fatal-reports

Conversation

@Algunenano

@Algunenano Algunenano commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Fatal error reports reach the client through send_logs_level and are stored in system.text_log and system.crash_log, so they should not contain runtime memory addresses. In the text of the report and in system.crash_log.fault_address, addresses are now printed only as offsets inside a loaded object, which is also the form addr2line / llvm-symbolizer need. The numeric system.crash_log.trace column will be handled in a separate PR, together with the other tables that store traces:

  • A frame outside every loaded object (e.g. JIT code) is printed as <unknown> in the bare Stack trace: line and without an address in the symbolized trace. StackTrace::resolveAddress returns a null address for it, so no consumer can print it.
  • Before the symbol index is built (clickhouse local and other tools that are not a daemon, or a fault at startup), main-executable frames are resolved from the executable's own program headers (__ehdr_start), without the index and without taking the loader lock, instead of being printed as runtime addresses. Frames in other objects are <unknown> in that line; the symbolized trace after it still names them.
  • For a fault, the report no longer prints si_pid / si_uid as the sender: they overlap si_addr, so they disclosed the fault address. The sender is printed only for signals sent by a process.
  • The fault address in Address: is shown below 4096 (a null pointer with an offset) or as an offset inside a loaded object (0x... in libc.so.6). system.crash_log.fault_address keeps only offsets inside the executable, since an offset into another object cannot be told apart in a bare number.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fatal error reports no longer contain runtime memory addresses: stack frames and the fault address are printed as offsets inside the executable or a library, which can be passed to addr2line, and other addresses are hidden. system.crash_log.fault_address now contains the offset inside the executable, or NULL when the address is elsewhere.


Workflow [PR]
Sync PR [sync-upstream/pr/126039]

Version info

  • Merged into: 26.11.1.53-master (included in 26.11 and later)
  • Backported to: 26.10.2.17, 26.9.23.6

Fatal error reports reach the client through `send_logs_level` and are
stored in `system.text_log` and `system.crash_log`. Print addresses only
as offsets inside a loaded object:

- An address outside every loaded object (e.g. JIT code) is printed as
  `<unknown>` in the bare stack trace and without an address in the
  symbolized one. `StackTrace::resolveAddress` no longer returns it.
- Before the symbol index is built (`clickhouse local`, or a fault at
  startup), addresses in the main executable are resolved from its own
  program headers instead of being printed as runtime addresses.
- The fault address is shown below 4096 or as an offset inside a loaded
  object; `system.crash_log.fault_address` keeps only offsets inside the
  executable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6a4f899]

Summary: ✅


AI Review

Summary

The PR hides unknown stack frames and converts fatal-report fault addresses to object-relative offsets, including before the symbol index is initialized. The signal-sender leak from the previous review is fixed. One address-disclosure path remains on macOS and FreeBSD, and the new masking behavior lacks focused regression coverage. Numeric trace columns are explicitly deferred by the author and are outside this review's remaining findings.

Findings

❌ Blockers

  • [P1] Unsupported platforms still disclose runtime addresses — src/Common/StackTrace.cpp:83–86. On macOS and FreeBSD, StackTrace::tryResolveAddress returns the unchanged pointer with AddressKind::Unsupported. The new helper accepts it, so a heap fault still exposes its runtime address in Address: and system.crash_log.fault_address when addresses are enabled. Bare traces print the unchanged pointer regardless of the address-display setting; macOS symbolized traces also retain runtime addresses because physical_addr equals virtual_addr. Hide unsupported addresses across these paths or implement platform-relative resolution. A standalone harness using the current helpers confirmed that the unsupported resolver and fault-address helper both preserve the original heap pointer.
Tests
  • ⚠️ The modified test only compares resolution of one main-executable address before and after index initialization. Add focused coverage for hidden heap/unknown addresses, executable/library fault addresses, null-pointer offsets, and the address-display setting, exercising the fault-message and storage helpers as well as stack formatting. The existing SIGABRT assertion of a null fault_address does not exercise fault-address sanitization.
Missing context / blind spots
  • ⚠️ No local ClickHouse build was available. The reproduction selected the portable Unsupported branch in a standalone harness; it was not a native macOS/FreeBSD server run. Native regression coverage would close that runtime-validation gap.
Final Verdict

Status: ❌ Block. Hide runtime addresses on the remaining platform paths and add regression coverage for the masking policy.

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Oct 15, 2026
Comment thread src/Common/StackTrace.cpp Resolved
Comment thread src/Common/StackTrace.cpp

if (!object)
return {virtual_addr, {}, StackTrace::AddressKind::UnknownMapping};
return {nullptr, {}, StackTrace::AddressKind::UnknownMapping};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Apply the hiding policy to the numeric crash trace

Returning a null address here does not protect system.crash_log.trace: collectCrashLog calls StackTrace::resolveAddressForStorage at src/Interpreters/CrashLog.cpp:127–128, and that helper still returns the original virtual_addr whenever the kind is not MainObject (src/Common/StackTrace.cpp:479–480). Consequently, ordinary libc frames and unknown/JIT frames still persist their runtime addresses in this column, even though trace_full and fault_address are sanitized. This leaves the crash report's numeric representation exposing the addresses the PR promises to hide.

Apply a safe representation when collecting the crash log, such as a sentinel for non-main frames or an object-qualified offset, and cover the numeric column in the regression test. The existing crash-log test explicitly permits non-main runtime addresses.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Agreed. resolveAddressForStorage also feeds system.stack_trace, system.errors and system.error_log, so system.crash_log.trace will be fixed in a future PR for all the tables that store traces. The PR description now states that this PR covers the text of the report and system.crash_log.fault_address only.

For a fault, `si_pid` and `si_uid` overlap `si_addr`, so printing them as
the sender published the fault address that is hidden in `Address:`. They
are set only for signals sent by a process (`si_code <= 0`).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added the comp-logging Logging/monitoring/observability (logs, metrics, tracing, instrumentation). label Oct 15, 2026
Comment thread src/Common/StackTrace.cpp Resolved
@Algunenano
Algunenano added this pull request to the merge queue Oct 16, 2026
Merged via the queue into ClickHouse:master with commit af19343 Oct 16, 2026
178 checks passed
@Algunenano
Algunenano deleted the hide-raw-addresses-in-fatal-reports branch October 16, 2026 09:36
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 16, 2026
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Oct 16, 2026
qoega pushed a commit to qoega/ClickHouse that referenced this pull request Oct 16, 2026
…ackTrace::tryResolveAddress`

ClickHouse#126039 changed
`StackTrace::tryResolveAddress` to return `ResolvedAddress` by value, with a
null address for an address that does not resolve, while `formatStackTrace`
in `gtest_functions_stress.cpp`, added in parallel, used it as an optional.
`unit_tests_dbms` does not compile on `master` since then.

Print the resolved address like `writeResolvedAddress` in `SignalHandlers.cpp`
does: `<unknown>` for an address that does not resolve, and the name of the
object for an address in a shared library.

https://github.com/ClickHouse/ClickHouse/actions/runs/38884911247/job/116920919005

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit c14207b)
davenger pushed a commit that referenced this pull request Oct 16, 2026
…ackTrace::tryResolveAddress`

#126039 changed
`StackTrace::tryResolveAddress` to return `ResolvedAddress` by value, with a
null address for an address that does not resolve, while `formatStackTrace`
in `gtest_functions_stress.cpp`, added in parallel, used it as an optional.
`unit_tests_dbms` does not compile on `master` since then.

Print the resolved address like `writeResolvedAddress` in `SignalHandlers.cpp`
does: `<unknown>` for an address that does not resolve, and the name of the
object for an address in a shared library.

https://github.com/ClickHouse/ClickHouse/actions/runs/38884911247/job/116920919005

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit c14207b)
alexey-milovidov added a commit that referenced this pull request Oct 16, 2026
…ackTrace::tryResolveAddress`

#126039 changed
`StackTrace::tryResolveAddress` to return `ResolvedAddress` by value, with a
null address for an address that does not resolve, while `formatStackTrace`
in `gtest_functions_stress.cpp`, added in parallel, used it as an optional.
`unit_tests_dbms` does not compile on `master` since then.

Print the resolved address like `writeResolvedAddress` in `SignalHandlers.cpp`
does: `<unknown>` for an address that does not resolve, and the name of the
object for an address in a shared library.

https://github.com/ClickHouse/ClickHouse/actions/runs/38884911247/job/116920919005

Co-Authored-By: Claude Opus 5.5 <[email protected]>
raimannma added a commit to raimannma/ClickHouse that referenced this pull request Oct 16, 2026
…ryResolveAddress`

ClickHouse#126039 made `StackTrace::tryResolveAddress` return
`ResolvedAddress` instead of `std::optional<ResolvedAddress>`, while
ClickHouse#126137 started using it as an optional in
`gtest_functions_stress.cpp`, so master does not compile `unit_tests_dbms`.

The same change as ClickHouse#126269, to unblock CI here.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=126134&sha=latest&name_0=PR&name_1=Build%20(arm_tidy%2C%203%2F4)
PR: ClickHouse#126134
huldarchen pushed a commit to huldarchen/ClickHouse that referenced this pull request Oct 16, 2026
…ackTrace::tryResolveAddress`

ClickHouse#126039 changed
`StackTrace::tryResolveAddress` to return `ResolvedAddress` by value, with a
null address for an address that does not resolve, while `formatStackTrace`
in `gtest_functions_stress.cpp`, added in parallel, used it as an optional.
`unit_tests_dbms` does not compile on `master` since then.

Print the resolved address like `writeResolvedAddress` in `SignalHandlers.cpp`
does: `<unknown>` for an address that does not resolve, and the name of the
object for an address in a shared library.

https://github.com/ClickHouse/ClickHouse/actions/runs/38884911247/job/116920919005

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Algunenano added a commit that referenced this pull request Oct 19, 2026
Backport #126039 to 26.10: Do not print runtime addresses in fatal error reports
robot-ch-test-poll3 added a commit that referenced this pull request Oct 19, 2026
Cherry pick #126039 to 26.9: Do not print runtime addresses in fatal error reports
@robot-clickhouse robot-clickhouse added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Oct 19, 2026
clickhouse-gh Bot added a commit that referenced this pull request Oct 19, 2026
Backport #126039 to 26.9: Do not print runtime addresses in fatal error reports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-logging Logging/monitoring/observability (logs, metrics, tracing, instrumentation). pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-improvement Pull request with some product improvements pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.9-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants