llvm-capstone/compiler-rt/lib
KAWASHIMA Takahiro 7d4167430c [gcov] Fix simultaneous .gcda creation/lock
Fixes PR45673

The commit 9180c14fe4 (D76206) resolved only a part of the problem
of concurrent .gcda file creation. It ensured that only one process
creates the file but did not ensure that the process locks the
file first. If not, the process which created the file may clobber
the contents written by a process which locked the file first.
This is the cause of PR45673.

This commit prevents the clobbering by revising the assumption
that a process which creates the file locks the file first.
Regardless of file creation, a process which locked the file first
uses fwrite (new_file==1) and other processes use mmap (new_file==0).

I also tried to keep the creation/first-lock process same by using
mkstemp/link/unlink but the code gets long. This commit is more
simple.

Note: You may be confused with other changes which try to resolve
concurrent file access. My understanding is (may not be correct):

D76206:   Resolve race of .gcda file creation (but not lock)
This one: Resolve race of .gcda file creation and lock
D54599:   Same as D76206 but abandoned?
D70910:   Resolve race of multi-threaded counter flushing
D74953:   Resolve counter sharing between parent/children processes
D78477:   Revision of D74953

Differential Revision: https://reviews.llvm.org/D79556
2020-05-13 13:03:03 +09:00
..
asan [ASan] Fix issue where system log buffer was not cleared after reporting an issue. 2020-03-26 10:56:17 -07:00
BlocksRuntime
builtins [builtins] Support architectures with 16-bit int 2020-04-26 01:22:10 +02:00
cfi
crt [cmake] Strip quotes in compiler-rt/lib/crt; error if checks fail 2020-03-09 15:52:39 -07:00
dfsan [dfsan] Remove realloc from done_abilist.txt 2020-05-05 22:32:45 -07:00
fuzzer [libFuzzer] Fix typo in seed_inputs flag description. NFC. 2020-04-09 13:54:07 +02:00
gwp_asan [GWP-ASan] Use functions in backtrace test, not line numbers. 2020-03-26 10:10:24 -07:00
hwasan [hwasan] Untag destination address in hwasan_posix_memalign. 2020-05-08 16:35:48 -07:00
interception
lsan [lsan] Support LeakSanitizer runtime on Fuchsia 2020-01-28 11:34:53 -08:00
msan [MSan] Enable for SystemZ 2020-04-16 12:15:01 +02:00
profile [gcov] Fix simultaneous .gcda creation/lock 2020-05-13 13:03:03 +09:00
safestack
sanitizer_common [hwasan] Fix allocator alignment. 2020-05-11 15:45:42 -07:00
scudo Add vendor identity check for Hygon Dhyana processor in Scudo 2020-05-11 09:17:57 -07:00
stats
tsan [compile-rt] Reduce #ifdef noise for ptrauth 2020-05-11 09:47:21 -07:00
ubsan [compile-rt] Reduce #ifdef noise for ptrauth 2020-05-11 09:47:21 -07:00
ubsan_minimal
xray [xray] Preserve x8 in trampoline on AArch64 2020-04-27 14:57:26 -04:00
CMakeLists.txt scudo: Add support for diagnosing memory errors when memory tagging is enabled. 2020-04-17 17:26:30 -07:00