diff options
| author | Bryan C. Mills <bcmills@google.com> | 2023-06-30 11:50:47 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-07-10 19:19:59 +0000 |
| commit | 07ede7a54379eef959cf29af5a87ea19c78a31fd (patch) | |
| tree | c5492e88cd6f4532628853acc2c764f855a2a0bb /src/syscall/exec_linux.go | |
| parent | 7dc62f3bda96359cc1904f4ea387f9a1c82c9f9d (diff) | |
| download | go-07ede7a54379eef959cf29af5a87ea19c78a31fd.tar.xz | |
syscall: serialize locks on ForkLock on platforms where forkExecPipe is not atomic
In CL 421441, we changed syscall to allow concurrent calls to
forkExec.
On platforms that support the pipe2 syscall that is the right
behavior, because pipe2 atomically opens the pipe with CLOEXEC already
set.
However, on platforms that do not support pipe2 (currently aix and
darwin), syscall.forkExecPipe is not atomic, and the pipes do not
initially have CLOEXEC set. If two calls to forkExec proceed
concurrently, a pipe intended for one child process can be
accidentally inherited by the other. If the process is long-lived, the
pipe can be held open unexpectedly and prevent the parent process from
reaching EOF reading the child's status from the pipe.
Fixes #61080.
Updates #23558.
Updates #54162.
Change-Id: I83edcc80674ff267a39d06260c5697c654ff5a4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/507355
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/syscall/exec_linux.go')
| -rw-r--r-- | src/syscall/exec_linux.go | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go index feb1e26432..dfbb38ac16 100644 --- a/src/syscall/exec_linux.go +++ b/src/syscall/exec_linux.go @@ -641,11 +641,6 @@ childerror: } } -// Try to open a pipe with O_CLOEXEC set on both file descriptors. -func forkExecPipe(p []int) (err error) { - return Pipe2(p, O_CLOEXEC) -} - func formatIDMappings(idMap []SysProcIDMap) []byte { var data []byte for _, im := range idMap { |
