diff options
| author | Michael Pratt <mpratt@google.com> | 2025-02-21 10:29:09 -0500 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-02-21 08:57:04 -0800 |
| commit | e1e65ae3ee5f977c31f3651233cc7ff2a0b579ca (patch) | |
| tree | 4ccb7852ab6c047bf9770c09dc67e26a88663dc9 /src/syscall/exec_linux.go | |
| parent | 64d82cd72c222caa93b2f71c5970a00ec4e7929a (diff) | |
| download | go-e1e65ae3ee5f977c31f3651233cc7ff2a0b579ca.tar.xz | |
runtime: use WCLONE when waiting on pidfd test child
As of CL 650835, the pidfd test child no longer sends SIGCHLD on exit.
Per clone(2), "If [the child termination] signal is specified as
anything other than SIGCHLD, then the parent process must specify the
__WALL or __WCLONE options when waiting for the child with wait(2)."
Align with this requirement.
For #71828.
Change-Id: I6a6a636c739e4a59abe1533fe429a433e8588939
Reviewed-on: https://go-review.googlesource.com/c/go/+/651415
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/syscall/exec_linux.go')
| -rw-r--r-- | src/syscall/exec_linux.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go index 7730bc6496..98151d34ac 100644 --- a/src/syscall/exec_linux.go +++ b/src/syscall/exec_linux.go @@ -779,7 +779,12 @@ func os_checkClonePidfd() error { var err error for { var status WaitStatus - _, err = Wait4(int(pid), &status, 0, nil) + // WCLONE is an untyped constant that sets bit 31, so + // it cannot convert directly to int on 32-bit + // GOARCHes. We must convert through another type + // first. + flags := uint(WCLONE) + _, err = Wait4(int(pid), &status, int(flags), nil) if err != EINTR { break } @@ -797,7 +802,7 @@ func os_checkClonePidfd() error { for { const _P_PIDFD = 3 - _, _, errno = Syscall6(SYS_WAITID, _P_PIDFD, uintptr(pidfd), 0, WEXITED, 0, 0) + _, _, errno = Syscall6(SYS_WAITID, _P_PIDFD, uintptr(pidfd), 0, WEXITED | WCLONE, 0, 0) if errno != EINTR { break } |
