diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2011-07-13 11:22:41 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-07-13 11:22:41 -0700 |
| commit | 86a659cad03b98d1921d72e3cf459bcd189ae0ec (patch) | |
| tree | 8833872c2c4c52d1d1100d38ebae4d5b81b8b106 /src/pkg/runtime/amd64 | |
| parent | dcdaeebdfb233758f7c22c2cad9c0e41dac765a6 (diff) | |
| download | go-86a659cad03b98d1921d72e3cf459bcd189ae0ec.tar.xz | |
runtime: fix data race during Itab hash update/lookup
The data race is on newly published Itab nodes, which are
both unsafely published and unsafely acquired. It can
break on IA-32/Intel64 due to compiler optimizations
(most likely not an issue as of now) and on ARM due to
hardware memory access reorderings.
R=rsc
CC=golang-dev
https://golang.org/cl/4673055
Diffstat (limited to 'src/pkg/runtime/amd64')
| -rw-r--r-- | src/pkg/runtime/amd64/asm.s | 6 | ||||
| -rw-r--r-- | src/pkg/runtime/amd64/atomic.c | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/pkg/runtime/amd64/asm.s b/src/pkg/runtime/amd64/asm.s index 46d82e3657..e03c9ebfdf 100644 --- a/src/pkg/runtime/amd64/asm.s +++ b/src/pkg/runtime/amd64/asm.s @@ -364,6 +364,12 @@ TEXT runtime·casp(SB), 7, $0 MOVL $1, AX RET +TEXT runtime·atomicstorep(SB), 7, $0 + MOVQ 8(SP), BX + MOVQ 16(SP), AX + XCHGQ AX, 0(BX) + RET + // void jmpdefer(fn, sp); // called from deferreturn. // 1. pop the caller diff --git a/src/pkg/runtime/amd64/atomic.c b/src/pkg/runtime/amd64/atomic.c index c031cc4f69..a4f2a114fc 100644 --- a/src/pkg/runtime/amd64/atomic.c +++ b/src/pkg/runtime/amd64/atomic.c @@ -10,3 +10,10 @@ runtime·atomicload(uint32 volatile* addr) { return *addr; } + +#pragma textflag 7 +void* +runtime·atomicloadp(void* volatile* addr) +{ + return *addr; +} |
