[compiler-rt] Guard both Printf in WorkerThread with mutex (PR #138088)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 30 23:16:54 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Jaroslav Lobačevski (JarLob)

<details>
<summary>Changes</summary>

The first Printf in WorkerThread wasn't guarded with mutex

---
Full diff: https://github.com/llvm/llvm-project/pull/138088.diff


1 Files Affected:

- (modified) compiler-rt/lib/fuzzer/FuzzerDriver.cpp (+1) 


``````````diff
diff --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
index 3771abf5f532d..bf60606594693 100644
--- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
@@ -239,6 +239,7 @@ static void WorkerThread(const Command &BaseCmd, std::atomic<unsigned> *Counter,
     Cmd.combineOutAndErr();
     if (Flags.verbosity) {
       std::string CommandLine = Cmd.toString();
+      std::lock_guard<std::mutex> Lock(Mu);
       Printf("%s\n", CommandLine.c_str());
     }
     int ExitCode = ExecuteCommand(Cmd);

``````````

</details>


https://github.com/llvm/llvm-project/pull/138088


More information about the llvm-commits mailing list