1 // Copyright 2017 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
7 // This program hung when run under the C/C++ ThreadSanitizer. TSAN installs a
8 // libc interceptor that writes signal handlers to a global variable within the
9 // TSAN runtime instead of making a sigaction system call. A bug in
10 // syscall.runtime_AfterForkInChild corrupted TSAN's signal forwarding table
11 // during calls to (*os/exec.Cmd).Run, causing the parent process to fail to
12 // invoke signal handlers.
25 ch
:= make(chan os
.Signal
)
26 signal
.Notify(ch
, syscall
.SIGUSR1
)
28 if err
:= exec
.Command("true").Run(); err
!= nil {
29 fmt
.Fprintf(os
.Stderr
, "Unexpected error from `true`: %v", err
)
33 syscall
.Kill(syscall
.Getpid(), syscall
.SIGUSR1
)