]> git.feebdaed.xyz Git - 0xmirror/go.git/commitdiff
runtime/secret: restore goroutine behavior to proposal
authorDaniel Morsing <daniel.morsing@gmail.com>
Wed, 10 Dec 2025 10:07:56 +0000 (10:07 +0000)
committerDavid Chase <drchase@google.com>
Fri, 12 Dec 2025 20:26:44 +0000 (12:26 -0800)
During review of CL 704615, a suggestion was made that spawning a
goroutine inside a call to secret.Do result in a panic. I agreed with
this at the time, but had missed that this had been extensively
discussed on the proposal. Revert the behavior back to what was agreed
upon.

Change-Id: Ifaa9e24bd03ecbd870ae2217137d1a9527c96842
Reviewed-on: https://go-review.googlesource.com/c/go/+/728920
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
src/runtime/proc.go
src/runtime/secret/secret.go

index 465a1adb601eca8d4b1e66c77607297bdbd4dc97..5ea96f03f5d125c8359478708b21e534d05d0580 100644 (file)
@@ -5286,10 +5286,6 @@ func malg(stacksize int32) *g {
 // The compiler turns a go statement into a call to this.
 func newproc(fn *funcval) {
        gp := getg()
-       if goexperiment.RuntimeSecret && gp.secret > 0 {
-               panic("goroutine spawned while running in secret mode")
-       }
-
        pc := sys.GetCallerPC()
        systemstack(func() {
                newg := newproc1(fn, gp, pc, false, waitReasonZero)
index f669b98828d0d16adae4bbdfb84f4c4e4dffe332..9eae22605fba0b1ee967b6307ee59f6bff4dd6b2 100644 (file)
@@ -28,7 +28,7 @@ import (
 //   - Currently only supported on linux/amd64 and linux/arm64.  On unsupported
 //     platforms, Do will invoke f directly.
 //   - Protection does not extend to any global variables written by f.
-//   - Any attempt to launch a goroutine by f will result in a panic.
+//   - Protection does not extend to any new goroutines made by f.
 //   - If f calls runtime.Goexit, erasure can be delayed by defers
 //     higher up on the call stack.
 //   - Heap allocations will only be erased if the program drops all