Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os: Crash all applications on MacOS with Apple Silicon with p, err := os.FindProcess(-1) follow by p.Signal(syscall.SIGTERM) #68496

Closed
ajsinclair opened this issue Jul 17, 2024 · 5 comments
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ajsinclair
Copy link

Go version

Go toolchain at go1.23-20240626-RC01

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/asinclair/Library/Caches/go-build'
GOENV='/Users/asinclair/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/asinclair/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/asinclair/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/asinclair/sdk/gotip'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/asinclair/sdk/gotip/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='devel go1.23-fc51e50 Wed Jul 17 15:08:04 2024 +0000'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/asinclair/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sq/lttg4ysx3llf5s_t8_msn0gc009j2t/T/go-build1015358713=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Just run this: https://go.dev/play/p/xzGhahkjjJH?v=gotip

As far as I can tell it is due to this commit: beaf7f3

What did you see happen?

All userspace programs on my Mac seem to crash. E.g. Chrome, etc. My Wifi drops out before recovering. The desktop background goes grey.

What did you expect to see?

No crashing.

@ajsinclair
Copy link
Author

I don't suspect it's an OS bug but maybe we should continue guarding against such a bad outcome.

@seankhliao seankhliao changed the title Crash all applications on MacOS with Apple Silicon with p, err := os.FindProcess(-1) follow by p.Signal(syscall.SIGTERM) os: Crash all applications on MacOS with Apple Silicon with p, err := os.FindProcess(-1) follow by p.Signal(syscall.SIGTERM) Jul 17, 2024
@seankhliao seankhliao added OS-Darwin NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jul 17, 2024
@seankhliao
Copy link
Member

cc @golang/runtime

@ianlancetaylor
Copy link
Member

This is happening because calling the kill system call with a PID of -1 sends the signal to all processes for which you have permission to send a signal. Before the CL we had special cases for PID 0 and -1 that prevented this from happening. I think we should restore those special rules.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/599015 mentions this issue: os: don't try to signal PID 0 or -1 on Unix

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed OS-Darwin NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jul 17, 2024
@dmitshur dmitshur added this to the Go1.23 milestone Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants