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

Jaroslav Lobačevski via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 30 23:16:01 PDT 2025


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

The first Printf in WorkerThread wasn't guarded with mutex

>From 1ac6bd0c71bb88f77624bebca4f678296c97396a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaroslav=20Loba=C4=8Devski?= <jarlob at github.com>
Date: Thu, 1 May 2025 08:15:14 +0200
Subject: [PATCH] Guard both Printf in WorkerThread with mutex

The first Printf in WorkerThread wasn't guarded with mutex
---
 compiler-rt/lib/fuzzer/FuzzerDriver.cpp | 1 +
 1 file changed, 1 insertion(+)

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);



More information about the llvm-commits mailing list