Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler-rt/lib/asan/asan_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ void PlatformTSDDtor(void *tsd) {
# endif

static void BeforeFork() {
VReport(2, "BeforeFork tid: %llu\n", GetTid());
if (CAN_SANITIZE_LEAKS) {
__lsan::LockGlobal();
}
Expand All @@ -168,6 +169,7 @@ static void AfterFork(bool fork_child) {
if (CAN_SANITIZE_LEAKS) {
__lsan::UnlockGlobal();
}
VReport(2, "AfterFork tid: %llu\n", GetTid());
}

void InstallAtForkHandler() {
Expand Down
2 changes: 2 additions & 0 deletions compiler-rt/lib/dfsan/dfsan_custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2859,13 +2859,15 @@ WRAPPER_ALIAS(__isoc99_sscanf, sscanf)
WRAPPER_ALIAS(__isoc23_sscanf, sscanf)

static void BeforeFork() {
VReport(2, "BeforeFork tid: %llu\n", GetTid());
StackDepotLockBeforeFork();
ChainedOriginDepotLockBeforeFork();
}

static void AfterFork(bool fork_child) {
ChainedOriginDepotUnlockAfterFork(fork_child);
StackDepotUnlockAfterFork(fork_child);
VReport(2, "AfterFork tid: %llu\n", GetTid());
}

SANITIZER_INTERFACE_ATTRIBUTE
Expand Down
2 changes: 2 additions & 0 deletions compiler-rt/lib/hwasan/hwasan_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ uptr TagMemoryAligned(uptr p, uptr size, tag_t tag) {
}

static void BeforeFork() {
VReport(2, "BeforeFork tid: %llu\n", GetTid());
if (CAN_SANITIZE_LEAKS) {
__lsan::LockGlobal();
}
Expand All @@ -547,6 +548,7 @@ static void AfterFork(bool fork_child) {
if (CAN_SANITIZE_LEAKS) {
__lsan::UnlockGlobal();
}
VReport(2, "AfterFork tid: %llu\n", GetTid());
}

void HwasanInstallAtForkHandler() {
Expand Down
2 changes: 2 additions & 0 deletions compiler-rt/lib/lsan/lsan_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ void InstallAtExitCheckLeaks() {
}

static void BeforeFork() {
VReport(2, "BeforeFork tid: %llu\n", GetTid());
LockGlobal();
LockThreads();
LockAllocator();
Expand All @@ -108,6 +109,7 @@ static void AfterFork(bool fork_child) {
UnlockAllocator();
UnlockThreads();
UnlockGlobal();
VReport(2, "AfterFork tid: %llu\n", GetTid());
}

void InstallAtForkHandler() {
Expand Down
2 changes: 2 additions & 0 deletions compiler-rt/lib/msan/msan_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ void MsanTSDDtor(void *tsd) {
# endif

static void BeforeFork() {
VReport(2, "BeforeFork tid: %llu\n", GetTid());
// Usually we lock ThreadRegistry, but msan does not have one.
LockAllocator();
StackDepotLockBeforeFork();
Expand All @@ -313,6 +314,7 @@ static void AfterFork(bool fork_child) {
StackDepotUnlockAfterFork(fork_child);
UnlockAllocator();
// Usually we unlock ThreadRegistry, but msan does not have one.
VReport(2, "AfterFork tid: %llu\n", GetTid());
}

void InstallAtForkHandler() {
Expand Down
2 changes: 2 additions & 0 deletions compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ int Finalize(ThreadState *thr) {

#if !SANITIZER_GO
void ForkBefore(ThreadState* thr, uptr pc) SANITIZER_NO_THREAD_SAFETY_ANALYSIS {
VReport(2, "BeforeFork tid: %llu\n", GetTid());
GlobalProcessorLock();
// Detaching from the slot makes OnUserFree skip writing to the shadow.
// The slot will be locked so any attempts to use it will deadlock anyway.
Expand Down Expand Up @@ -847,6 +848,7 @@ static void ForkAfter(ThreadState* thr,
SlotAttachAndLock(thr);
SlotUnlock(thr);
GlobalProcessorUnlock();
VReport(2, "AfterFork tid: %llu\n", GetTid());
}

void ForkParentAfter(ThreadState* thr, uptr pc) { ForkAfter(thr, false); }
Expand Down
Loading