runtime: make fatal failures unrecoverable

Match the Go runtime by terminating for deadlocks, stack overflows,
runtime and GC invariants, invalid lock operations, and platform
initialization failures instead of routing them through panic/recover.

Keep language-level runtime errors and unsupported user operations
recoverable. Add crash coverage that verifies fatal errors bypass deferred
recover calls.
This commit is contained in:
Jake Bailey
2026-07-24 10:49:50 -07:00
committed by Ron Evans
parent 9105cce340
commit 16fc1ea2bb
41 changed files with 144 additions and 101 deletions
+2 -2
View File
@@ -80,7 +80,7 @@ func findGlobals(found func(start, end uintptr)) {
// Sanity check that we're actually looking at a MachO header.
if gcAsserts && libc_mh_execute_header.magic != MH_MAGIC_64 {
runtimePanic("gc: unexpected MachO header")
runtimeFatal("gc: unexpected MachO header")
}
// Iterate through the load commands.
@@ -106,7 +106,7 @@ func findGlobals(found func(start, end uintptr)) {
// Note that when ASLR is disabled (for example, when
// running inside lldb), the offset is zero. That's why we
// need a separate hasOffset for this assert.
runtimePanic("gc: did not detect ASLR offset")
runtimeFatal("gc: did not detect ASLR offset")
}
// Scan this segment for GC roots.
// This could be improved by only reading the memory areas