runtime: fatal error stack traces are swallowed for binaries with elevated privileges #68103
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go version go1.22.4 linux/amd64
Output of
go env
in your module/workspace:What did you do?
The following program will generate a
fatal error: concurrent map writes
Run it with go run
Now run it with elevated privileges
Stack traces are gone.
What did you see happen?
A stack trace
What did you expect to see?
Referring to #60272, I expected the traces to be shown when using
debug.SetTraceback("all")
. But this solution only works forpanic
errors, and does not forfatal
errors thrown internally from the go runtime (especially the map implementation).Referring to the internal go runtime panic.go, it is mentioned that fatal does not include runtime frames, system goroutines, or frame metadata (fp, sp, pc) in the stack trace unless GOTRACEBACK=system or higher. Setting
SetTraceback
tosystem
does not work either, as traces are also swallowed.This issue, related to the change #60272 , is because the
fatal
function only checks forisSecureMode
, while thepanic
function checks thegotraceback
value before dumping the stack trace.The text was updated successfully, but these errors were encountered: