diff options
| author | James Chacon <jchacon@google.com> | 2016-05-06 11:51:56 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2016-05-18 01:04:55 +0000 |
| commit | 733162fd6c0df8bd700859974957b25045fe9ee4 (patch) | |
| tree | ca6e940629076e93138d9217d922fbfb4fe72a27 /src/runtime/testdata | |
| parent | f744717d1924340b8f5e5a385e99078693ad9097 (diff) | |
| download | go-733162fd6c0df8bd700859974957b25045fe9ee4.tar.xz | |
runtime: prevent racefini from being invoked more than once
racefini calls __tsan_fini which is C code and at the end of it
invoked the standard C library exit(3) call. This has undefined
behavior if invoked more than once. Specifically in C++ programs
it caused static destructors to run twice. At least on glibc
impls it also means the at_exit handlers list (where those are
stored) also free's a list entry when it completes these. So invoking
twice results in a double free at exit which trips debug memory
allocation tracking.
Fix all of this by using an atomic as a boolean barrier around
calls to racefini being invoked > 1 time.
Fixes #15578
Change-Id: I49222aa9b8ded77160931f46434c61a8379570fc
Reviewed-on: https://go-review.googlesource.com/22882
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/testdata')
0 files changed, 0 insertions, 0 deletions
