Repository navigation
Report a crash whose own stack capture faults, and recover SIGILL from stack unwinding on AArch64 - #132186
Report a crash whose own stack capture faults, and recover SIGILL from stack unwinding on AArch64#132186groeneai wants to merge 3 commits into
Conversation
…AArch64 With `-mbranch-protection=pac-ret` (ClickHouse#131784) libunwind authenticates every signed return address it reads with `autia1716`. On cores with FEAT_FPAC (Graviton4 = Neoverse V2, which runs CI's arm jobs) a failed authentication raises SIGILL instead of silently corrupting the pointer. Two gaps then turn one inconsistent frame into a silent death: - `signalHandler` recovered a fault during `asynchronous_stack_unwinding` only for SIGSEGV (and SIGBUS on Darwin), so a SIGILL in the query profiler's or `system.stack_trace`'s walk took the fatal path. Recover SIGILL too on Linux AArch64, the only platform where return addresses are signed. - The deadly handler and the SIGTSTP handler block the fault signals in their `sa_mask`. When their own `StackTrace(ucontext)` walk faults, the signal is blocked, and Linux kills the process at once (`force_sig_fault` resets a blocked synchronous signal to SIG_DFL), before the record reaches the signal pipe. Unblock the recoverable signals around that capture; the `sigsetjmp(..., 1)` in the capture saves the unblocked mask, so both the normal and the recovered path fall through to the single restore. The crash is then reported with an empty trace instead of vanishing. Master SQLLogic test on 929e3b4 (Graviton4) lost its server this way: exit 132, no `<Fatal>` line, the socket gone in under 2 s. Under qemu-user with FEAT_FPAC (`-cpu max`), the CI arm_release binary dies with rc 132 and no report both when a thread's own `autiasp` fails and when a `system.stack_trace` capture meets that frame; with this change the first is reported (`Received signal Illegal instruction (4)`, `Illegal operand.`) and the second capture is dropped while the server keeps running. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test only checked that a record was written, which a capture that never reached the corrupted frame also produces. Decode the record as `SignalListener::run` does and require an empty trace: `StackTrace(ucontext)` returns size 0 only from its fault branch. A clean SIGTSTP capture first must have frames, which also proves the decode reads the right field. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop the SIGILL sentence from the recovery comment in signalHandler: the definition of unwind_fault_signals already states it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 2 findings, then 0 on the delta recheck) plus my own review (nits only).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-11:20261117-005300 |
|
cc @mstetsyuk, could you review this? The crash and SIGTSTP handlers block the fault signals, so a fault in their own StackTrace(ucontext) walk killed the server before the report was written; the change unblocks the recoverable signals around that capture and also recovers SIGILL from a failed return address authentication (pac-ret, FEAT_FPAC) on Linux AArch64. |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20261116-221800 |
|
Workflow [PR], commit [ac234d2] Summary: ❌
AI ReviewSummaryReviewed #132186 at Empty-trace consumers checked: Missing context / blind spots
Final VerdictStatus: ✅ Approve |
CI finish ledger - ac234d2Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The other CIDB Session id: cron:our-pr-ci-monitor:20261117-043014 |
|
Another silent death, and this one kept a core:
The row is wrong because |
|
The same chain now kills a master Its core (build id On master that makes 4 silent arm deaths since #131784 merged (3 |
DataLakeCatalog catalog replayed from stored metadata
#132097
Related: #131784
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
A crash whose own stack trace capture faults is now reported in the server log with an empty trace, instead of the server exiting without a report. On AArch64 this includes a failed return address authentication.
Description
Master
SQLLogic testlost its server with exit code 132 (SIGILL) and no<Fatal>line on 929e3b414e and e53b32344d (Graviton4,arm_release): 2 of 58 master commits since #131784, 0 of 518 in the 10 days before.Since #131784, libunwind authenticates every signed return address it reads with
autia1716. On cores with FEAT_FPAC (Graviton4), a failed authentication raises SIGILL. Two gaps turn that into a silent death:signalHandlerrecovers a fault of an asynchronous capture (query profiler,system.stack_trace) only for SIGSEGV (and SIGBUS on Darwin).StackTrace(ucontext)walk faults, the kernel kills the process before the record is written. For SIGSEGV this is pre-existing on every architecture.The change: SIGILL is recovered too on Linux AArch64, and the recoverable signals are unblocked around the capture in
signalHandler.Validation:
-cpu max(FEAT_FPAC), gdb makes one return address fail authentication. The CI binary and a base cross build die silently (rc 132) on the thread's own return and during asystem.stack_tracecapture. With the fix, the first logsReceived signal Illegal instruction (4); in the second, the capture is dropped and the server runs on until that return, which is then reported.What raised the first signal is unknown (neither run kept a core or server log); a recurrence is now reported, or survived if it was a capture. Reverting #131784 would also stop these deaths, at the cost of the hardening.
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/132186]