]> Cypherpunks repositories - gostls13.git/commit
runtime: fix atomic operations on non-heap addresses
authorDmitriy Vyukov <dvyukov@google.com>
Thu, 20 Nov 2014 14:51:02 +0000 (09:51 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 20 Nov 2014 14:51:02 +0000 (09:51 -0500)
commit2b3f37908060837f8715c61af110b01b8a590c7c
tree00660a2634b6ed96f3d80a534845aaadfd038283
parent361199749d81d06cc1007db9f7da5818b6f830b2
runtime: fix atomic operations on non-heap addresses
Race detector runtime does not tolerate operations on addresses
that was not previously declared with __tsan_map_shadow
(namely, data, bss and heap). The corresponding address
checks for atomic operations were removed in
https://golang.org/cl/111310044
Restore these checks.
It's tricker than just not calling into race runtime,
because it is the race runtime that makes the atomic
operations themselves (if we do not call into race runtime
we skip the atomic operation itself as well). So instead we call
__tsan_go_ignore_sync_start/end around the atomic operation.
This forces race runtime to skip all other processing
except than doing the atomic operation itself.
Fixes #9136.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/179030043
src/runtime/race.c
src/runtime/race/race_unix_test.go [new file with mode: 0644]
src/runtime/race_amd64.s