[all-commits] [llvm/llvm-project] bec223: [profile] Don't crash when forking in several threads

calixteman via All-commits all-commits at lists.llvm.org
Thu May 7 05:14:11 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: bec223a9bc4eb9747993ee9a4c1aa135c32123e6
      https://github.com/llvm/llvm-project/commit/bec223a9bc4eb9747993ee9a4c1aa135c32123e6
  Author: Calixte Denizet <calixte.denizet at gmail.com>
  Date:   2020-05-07 (Thu, 07 May 2020)

  Changed paths:
    M clang/lib/Driver/ToolChains/Darwin.cpp
    M compiler-rt/lib/profile/GCDAProfiling.c
    A compiler-rt/test/profile/Inputs/instrprof-gcov-multithread_fork.cpp
    A compiler-rt/test/profile/instrprof-gcov-multithread_fork.test
    M llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list