julia
1d1078de - signals: report fault location for crashes on foreign threads (#62547)

Commit
29 days ago
signals: report fault location for crashes on foreign threads (#62547) 🤖 When a fatal signal (e.g. SIGSEGV) arrives on a thread that Julia did not create or adopt, `jl_fprint_critical_error` has no ptls backtrace buffer to use, so it printed no frames at all -- not even the faulting instruction pointer. For example, a segfault in foreign code on such a thread (observed with a juliac-compiled shared library running under a foreign host runtime) produced only: [2] signal 11 (1): Segmentation fault in expression starting at none:0 Allocations: 1318316 (Pool: 1318267; Big: 49); GC: 2 which gives nothing to debug with, even though the signal context is available at that point. Diagnosing such crashes previously required installing a custom chained signal handler just to learn the pc and thread identity. Improve the crash report in this situation: - If the crashing thread has no Julia task context, record a native-only backtrace from the signal context into a small stack buffer (all of the machinery involved -- `rec_backtrace_ctx`, safe-restore, and `jl_fprint_native_codeloc` -- is already safe to use on unmanaged threads), and note the OS thread id and name (Linux) so the thread can be identified. - Print the fault address (`si_addr`) for kernel-generated SIGSEGV and SIGBUS, in the same place `jl_fprint_sigill` prints its extra fault detail. - If backtrace collection yields no frames at all, say so explicitly instead of printing nothing. The report for crashes on Julia-managed threads is unchanged apart from the new fault address line. Co-authored-by: Keno Fischer <Keno@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Author
Parents
Loading