aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/amd64
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2011-07-29 13:47:24 -0400
committerRuss Cox <rsc@golang.org>2011-07-29 13:47:24 -0400
commit91f0f18100564478f77c6fc8e16ea56f9528951c (patch)
tree896657acbedd11f0ca7203c2b582b73a22252668 /src/pkg/runtime/amd64
parenteb2b3f5dc74181b66848bef194bfd0ec1401345c (diff)
downloadgo-91f0f18100564478f77c6fc8e16ea56f9528951c.tar.xz
runtime: fix data race in findfunc()
The data race can lead to reads of partially initialized concurrently mutated symbol data. The change also adds a simple sanity test for Caller() and FuncForPC(). R=rsc CC=golang-dev https://golang.org/cl/4817058
Diffstat (limited to 'src/pkg/runtime/amd64')
-rw-r--r--src/pkg/runtime/amd64/asm.s6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkg/runtime/amd64/asm.s b/src/pkg/runtime/amd64/asm.s
index 4723018a7a..3e3818c101 100644
--- a/src/pkg/runtime/amd64/asm.s
+++ b/src/pkg/runtime/amd64/asm.s
@@ -398,6 +398,12 @@ TEXT runtimeĀ·atomicstorep(SB), 7, $0
XCHGQ AX, 0(BX)
RET
+TEXT runtimeĀ·atomicstore(SB), 7, $0
+ MOVQ 8(SP), BX
+ MOVL 16(SP), AX
+ XCHGL AX, 0(BX)
+ RET
+
// void jmpdefer(fn, sp);
// called from deferreturn.
// 1. pop the caller