Fixes #73490
Change-Id: I500fa73f4215c7f490779f53c1c2c0d775f51a95
Reviewed-on: https://go-review.googlesource.com/c/go/+/667775
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
log.Fatal(err)
}
cmd := exec.Command(exe, "-test.run=^ExampleSetCrashOutput_monitor$")
- cmd.Env = append(os.Environ(), monitorVar+"=1")
+ // Be selective in which variables we allow the child to inherit.
+ // Depending on the application, some may be necessary,
+ // while others (e.g. GOGC, GOMEMLIMIT) may be harmful; see #73490.
+ cmd.Env = []string{monitorVar + "=1"}
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stderr
pipe, err := cmd.StdinPipe()