Skip to content

Instantly share code, notes, and snippets.

@bwester
Created April 15, 2022 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwester/ce562a29ca126791d64f1aa054cf5429 to your computer and use it in GitHub Desktop.
Save bwester/ce562a29ca126791d64f1aa054cf5429 to your computer and use it in GitHub Desktop.
A minimal Go program that can cause a deadlock in the Exec call. Compile with CGO_ENABLED=0. Tested on macOS 11.6.5, go1.18.1 darwin/amd64.
package main
import (
"log"
"os"
"os/signal"
"syscall"
)
func main() {
signal.Notify(make(chan os.Signal, 1), syscall.SIGHUP)
log.Fatal(syscall.Exec("/usr/bin/true", []string{"true"}, nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment