Skip to content

runtime/race: race detector can call exit more than once on finish #15578

@jmchacon

Description

@jmchacon

Seen on linux amd64 1.6 (but verified present at tip as well)

When using the race detector and C++ code is linked into the process as well it's possible for 2 threads to call racefini() today which eventually calls __tsan_fini which itself calls the regular C library exit().

Calling exit > 1 times is undefined behavior and means in a C++ program that the static destructors get invoked twice. On a glibc implementation of the exit handlers it also means a double free() occurs when the entry from the exit handlers list is freed upon completion.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions