summaryrefslogtreecommitdiff
path: root/src/syscall/syscall_linux.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2022-04-28 11:44:28 -0400
committerGopher Robot <gobot@golang.org>2022-04-28 16:00:39 +0000
commit17371eea25f203575389f85b33ddb58792d25e84 (patch)
treef74018adffffbca2bdba7fb1fcac44e788db850d /src/syscall/syscall_linux.go
parent4d350710a23c505f0afcc6bcd8ac7ba37145b521 (diff)
downloadgo-git-17371eea25f203575389f85b33ddb58792d25e84.tar.gz
syscall: add //go:norace to RawSyscall
RawSyscall is used in a variety of rather unsafe conditions, such as after fork in forkAndExecInChild1. Disable race instrumentation to avoid calling TSAN in unsafe conditions. For #51087 Change-Id: I47c35e6f0768c77ddab99010ea0404c45ad2f1da Reviewed-on: https://go-review.googlesource.com/c/go/+/402914 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/syscall/syscall_linux.go')
-rw-r--r--src/syscall/syscall_linux.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/syscall/syscall_linux.go b/src/syscall/syscall_linux.go
index f9adecdd5e..ab634a2cbe 100644
--- a/src/syscall/syscall_linux.go
+++ b/src/syscall/syscall_linux.go
@@ -46,11 +46,15 @@ func runtime_exitsyscall()
// uintptr arguments are pointers, because some values may look like pointers,
// but not really be pointers, and adjusting their value would break the call.
//
+// //go:norace, on RawSyscall, to avoid race instrumentation if RawSyscall is
+// called after fork, or from a signal handler.
+//
// //go:linkname to ensure ABI wrappers are generated for external callers
// (notably x/sys/unix assembly).
//go:uintptrkeepalive
//go:nosplit
+//go:norace
//go:linkname RawSyscall
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
return RawSyscall6(trap, a1, a2, a3, 0, 0, 0)