diff --git a/src/runtime/debug/example_monitor_test.go b/src/runtime/debug/example_monitor_test.go index 3b8f4dccd9f05325a8bd40fe9a3c0a4c70cbaec5..ed6757df855d08eab60c336e3d577ae664169868 100644 --- a/src/runtime/debug/example_monitor_test.go +++ b/src/runtime/debug/example_monitor_test.go @@ -84,7 +84,10 @@ func monitor() { 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()