Bug 1705641 - Don't flush ccov counters when process is dying when env var MOZ_FUZZING_CCOV is defined r=andi

Sometimes there is a deadlock between user-requested ccov counters flush (through a signal) and flush happening when a process is dying.
So in order to avoid it, just remove the latter which is out of our control (user-requested flushes are protected using a cross mutex).

Differential Revision: https://phabricator.services.mozilla.com/D112632
This commit is contained in:
Calixte Denizet 2021-04-28 18:30:35 +00:00
parent 1ea987eb07
commit f40b4cac3c
2 changed files with 29 additions and 1 deletions

View File

@ -19,6 +19,7 @@
"downgrade-mangling-error_clang_12.patch",
"revert-llvmorg-12-init-7827-g2a078c307204.patch",
"tsan-D101154.patch",
"loosen-msvc-detection.patch"
"loosen-msvc-detection.patch",
"fuzzing_ccov_build_clang_12.patch"
]
}

View File

@ -0,0 +1,27 @@
From 98bf90ef5ea3dd848ce7d81a662eb7499d11c91c Mon Sep 17 00:00:00 2001
From: Calixte Denizet <calixte.denizet@gmail.com>
Date: Fri, 16 Apr 2021 10:05:34 +0200
Subject: [PATCH] [Gcov] Don't run global destructor in ccov builds when env
MOZ_FUZZING_CCOV is existing
---
compiler-rt/lib/profile/GCDAProfiling.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c
index 4293e8f7b5bf..6cda4bc7601f 100644
--- a/compiler-rt/lib/profile/GCDAProfiling.c
+++ b/compiler-rt/lib/profile/GCDAProfiling.c
@@ -586,6 +586,9 @@ void llvm_writeout_files(void) {
__attribute__((destructor(100)))
#endif
static void llvm_writeout_and_clear(void) {
+ if (getenv("MOZ_FUZZING_CCOV")) {
+ return;
+ }
llvm_writeout_files();
fn_list_remove(&writeout_fn_list);
}
--
2.30.2