aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-11-11 12:42:51 -0800
committerGopher Robot <gobot@golang.org>2022-11-11 23:24:12 +0000
commit122a22e0e9eba7fe712030d429fc4bcf6f447f5e (patch)
tree70a73ef22581e2b649e483b1d108132e57a73418 /src/runtime
parent7e4191e686c192b9c85065fd3b8775190d3e9c5f (diff)
downloadgo-122a22e0e9eba7fe712030d429fc4bcf6f447f5e.tar.xz
internal/syscall/unix: use runtime.gostring for Gostring
Under the race detector, checkptr flags uses of unsafe.Slice that result in slices that straddle multiple Go allocations. Avoid that scenario by calling existing runtime code. This fixes a failure on the darwin-.*-race builders introduced in CL 446178. Change-Id: I6e0fdb37e3c3f38d97939a8799bb4d10f519c5b9 Reviewed-on: https://go-review.googlesource.com/c/go/+/449936 Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/string.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go
index eaade640c4..a00976be59 100644
--- a/src/runtime/string.go
+++ b/src/runtime/string.go
@@ -325,6 +325,13 @@ func gostring(p *byte) string {
return s
}
+// internal_syscall_gostring is a version of gostring for internal/syscall/unix.
+//
+//go:linkname internal_syscall_gostring internal/syscall/unix.gostring
+func internal_syscall_gostring(p *byte) string {
+ return gostring(p)
+}
+
func gostringn(p *byte, l int) string {
if l == 0 {
return ""