aboutsummaryrefslogtreecommitdiff
path: root/src/syscall
diff options
context:
space:
mode:
authorroot <vishwanatha.hd@ibm.com>2023-04-01 18:36:57 +0000
committerGopher Robot <gobot@golang.org>2023-04-11 21:27:33 +0000
commit2fcca5d52dd3d23ec2ca3a81e588e0f9d877ca69 (patch)
treedc343d29212cce9ab3448d718768712c8f2ba003 /src/syscall
parentda879c6e6a89244c71e3cb9a3c1ace66ce3647f9 (diff)
downloadgo-2fcca5d52dd3d23ec2ca3a81e588e0f9d877ca69.tar.xz
syscall: add a Go directive "go:nocheckptr" to forkAndExecInChild1
forkAndExecInChild1 func must not acquire any locks in child, because they might have been locked at the time of the fork. This implies to no rescheduling, no malloc calls, and no new stack segments. So, doing a "checkptrAlignment" is bad here, because checkptr functions added by the instrumentation could grow the stack, which should not be done between fork and exec calls. Hence using a Go directive "go:nocheckptr" to forkAndExecInChild1 func,so that the compiler should not do "checkptrAlignment" when functions marked with "go:norace". This race detection bug was caught in go 1.21 on s390x. Running a "./race.bash" script from "go/src" directory failed and the bug details are provided in issue link mentioned below. Fixes #58785 Change-Id: I254091368b0789d886acdf26f8aa8d8f5a986b24 Reviewed-on: https://go-review.googlesource.com/c/go/+/481415 Auto-Submit: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/syscall')
-rw-r--r--src/syscall/exec_linux.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go
index 2a1f7ef1a7..feb1e26432 100644
--- a/src/syscall/exec_linux.go
+++ b/src/syscall/exec_linux.go
@@ -203,6 +203,7 @@ type cloneArgs struct {
//
//go:noinline
//go:norace
+//go:nocheckptr
func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid uintptr, err1 Errno, mapPipe [2]int, locked bool) {
// Defined in linux/prctl.h starting with Linux 4.3.
const (