diff --git a/doc/godebug.md b/doc/godebug.md index 43375deb5e..3a7a798028 100644 --- a/doc/godebug.md +++ b/doc/godebug.md @@ -167,6 +167,11 @@ escaped. Setting `htmlmetacontentescape=0` disables this behavior. To avoid content injection attacks, this setting and default was backported to Go 1.25.8 and Go 1.26.1. +Go 1.27 changes the default for `tracebacklabels` (added in [Go 1.26][#go-126]) +to `1`. This opt-out is expected to be kept indefinitely in case goroutine +labels acquire sensitive information that shouldn't be made available in +tracebacks. + ### Go 1.26 Go 1.26 added a new `httpcookiemaxnum` setting that controls the maximum number diff --git a/doc/next/4-runtime.md b/doc/next/4-runtime.md index 1f8e445e0b..4880a95af2 100644 --- a/doc/next/4-runtime.md +++ b/doc/next/4-runtime.md @@ -1 +1,10 @@ ## Runtime {#runtime} + + + +Tracebacks for modules with `go` directives configuring Go 1.27 or later will now +include [runtime/pprof](https://pkg.go.dev/runtime/pprof) goroutine labels in +the header line. This behavior can be disabled with `GODEBUG=tracebacklabels=0` +(added in [Go 1.26](/doc/godebug#go-126)). This opt-out is expected to be +kept indefinitely in case goroutine labels acquire sensitive information that +shouldn't be made available in tracebacks. diff --git a/src/internal/godebugs/table.go b/src/internal/godebugs/table.go index 5e33a0b0f3..7ddfad14ea 100644 --- a/src/internal/godebugs/table.go +++ b/src/internal/godebugs/table.go @@ -68,6 +68,10 @@ var All = []Info{ {Name: "tlssecpmlkem", Package: "crypto/tls", Changed: 26, Old: "0", Opaque: true}, {Name: "tlssha1", Package: "crypto/tls", Changed: 25, Old: "1"}, {Name: "tlsunsafeekm", Package: "crypto/tls", Changed: 22, Old: "1"}, + // Mark tracebacklabels as Opaque so we don't generate a metric that we can't increment. + // IncNonDefault uses a sync.Once, which involves sync.Mutex, and is not safe from a signal handler. + // (Tracebacks are generated in signal-handlers.) + {Name: "tracebacklabels", Package: "runtime", Changed: 27, Old: "0", Opaque: true}, {Name: "updatemaxprocs", Package: "runtime", Changed: 25, Old: "0"}, {Name: "urlmaxqueryparams", Package: "net/url", Changed: 24, Old: "0"}, {Name: "urlstrictcolons", Package: "net/url", Changed: 26, Old: "0"}, diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go index d5bce17563..10754eee1c 100644 --- a/src/runtime/runtime1.go +++ b/src/runtime/runtime1.go @@ -398,7 +398,7 @@ var dbgvars = []*dbgVar{ {name: "traceallocfree", atomic: &debug.traceallocfree}, {name: "tracecheckstackownership", value: &debug.traceCheckStackOwnership}, {name: "tracebackancestors", value: &debug.tracebackancestors}, - {name: "tracebacklabels", atomic: &debug.tracebacklabels, def: 0}, + {name: "tracebacklabels", atomic: &debug.tracebacklabels, def: 1}, {name: "tracefpunwindoff", value: &debug.tracefpunwindoff}, {name: "updatemaxprocs", value: &debug.updatemaxprocs, def: 1}, }