Skip to content

Commit 17371ee

Browse files
prattmicgopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Auto-Submit: Michael Pratt <[email protected]> Run-TryBot: Michael Pratt <[email protected]>
1 parent 4d35071 commit 17371ee

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/syscall/syscall_linux.go

+4
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ func runtime_exitsyscall()
4646
// uintptr arguments are pointers, because some values may look like pointers,
4747
// but not really be pointers, and adjusting their value would break the call.
4848
//
49+
// //go:norace, on RawSyscall, to avoid race instrumentation if RawSyscall is
50+
// called after fork, or from a signal handler.
51+
//
4952
// //go:linkname to ensure ABI wrappers are generated for external callers
5053
// (notably x/sys/unix assembly).
5154

5255
//go:uintptrkeepalive
5356
//go:nosplit
57+
//go:norace
5458
//go:linkname RawSyscall
5559
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
5660
return RawSyscall6(trap, a1, a2, a3, 0, 0, 0)

0 commit comments

Comments
 (0)