HomePhabricator

[profile] Don't crash when forking in several threads

Authored by Calixte Denizet <calixte.denizet@gmail.com> on Apr 20 2020, 1:50 AM.

Description

[profile] Don't crash when forking in several threads

Summary:
When forking in several threads, the counters were written out in using the same global static variables (see GCDAProfiling.c): that leads to crashes.
So when there is a fork, the counters are resetted in the child process and they will be dumped at exit using the interprocess file locking.
When there is an exec, the counters are written out and in case of failures they're resetted.

Reviewers: jfb, vsk, marco-c, serge-sans-paille

Reviewed By: marco-c, serge-sans-paille

Subscribers: llvm-commits, serge-sans-paille, dmajor, cfe-commits, hiraditya, dexonsmith, #sanitizers, marco-c, sylvestre.ledru

Tags: #sanitizers, #clang, #llvm

Differential Revision: https://reviews.llvm.org/D78477

Event Timeline

Calixte Denizet <calixte.denizet@gmail.com> committed rGbec223a9bc4e: [profile] Don't crash when forking in several threads (authored by Calixte Denizet <calixte.denizet@gmail.com>).May 7 2020, 5:13 AM