1
0
mirror of https://github.com/golang/go synced 2024-11-17 05:44:52 -07:00
go/misc/cgo
Nikhil Benesch e496e612b7 runtime: never call into race detector with retaken P
cgocall could previously invoke the race detector on an M whose P had
been retaken. The race detector would attempt to use the P-local state
from this stale P, racing with the thread that was actually wired to
that P. The result was memory corruption of ThreadSanitizer's internal
data structures that presented as hard-to-understand assertion failures
and segfaults.

Reorder cgocall so that it always acquires a P before invoking the race
detector, and add a test that stresses the interaction between cgo and
the race detector to protect against future bugs of this kind.

Fixes #27660.

Change-Id: Ide93f96a23490314d6647547140e0a412a97f0d4
Reviewed-on: https://go-review.googlesource.com/c/148717
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2018-11-09 21:47:48 +00:00
..
errors cmd/cgo: rewrite pointer checking to use more function literals 2018-11-01 21:54:54 +00:00
fortran
gmp
life test: remove rundircmpout and cmpout actions 2018-05-31 17:36:45 +00:00
nocgo
stdio test: remove rundircmpout and cmpout actions 2018-05-31 17:36:45 +00:00
test runtime: never call into race detector with retaken P 2018-11-09 21:47:48 +00:00
testasan
testcarchive misc/cgo/testcarchive: make the tests work when using gccgo 2018-08-21 15:03:10 +00:00
testcshared misc/cgo/testcshared: force descriptor 30 to be closed when execing test 2018-08-01 23:10:11 +00:00
testgodefs cmd/cgo: don't resolve typedefs in -godefs mode 2018-07-27 16:46:42 +00:00
testplugin all: fix a bunch of misspellings 2018-10-06 15:40:03 +00:00
testsanitizers all: fix a bunch of misspellings 2018-10-06 15:40:03 +00:00
testshared all: fix a bunch of misspellings 2018-10-06 15:40:03 +00:00
testsigfwd
testso
testsovar
testtls