[compiler-rt] d9ce33a - [libfuzzer] Prevent MSan false positive when printing log with -jobs (#91679)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 15:36:58 PDT 2024


Author: Thurston Dang
Date: 2024-05-10T15:36:55-07:00
New Revision: d9ce33a0eea701719651dafbf88deae0ece96976

URL: https://github.com/llvm/llvm-project/commit/d9ce33a0eea701719651dafbf88deae0ece96976
DIFF: https://github.com/llvm/llvm-project/commit/d9ce33a0eea701719651dafbf88deae0ece96976.diff

LOG: [libfuzzer] Prevent MSan false positive when printing log with -jobs (#91679)

libfuzzer's -jobs option will, depending on the number of CPUs, spin up
a
WorkerThread and end up printing the log file using CopyFileToErr.
This leads to an MSan false positive. This patch disables the MSan
interceptor checks,
similarly to other instances in https://reviews.llvm.org/D48891

Side-note: this false positive issue first appeared when printf()
was replaced by puts() (90b4d1bcb20180c591385131b12fa90d2e4860b1).
The interceptor check was always present; however, MSan does not
check_printf by default.

Added: 
    

Modified: 
    compiler-rt/lib/fuzzer/FuzzerDriver.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
index 8674d788932f8..3771abf5f532d 100644
--- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
@@ -229,6 +229,7 @@ static void PulseThread() {
 
 static void WorkerThread(const Command &BaseCmd, std::atomic<unsigned> *Counter,
                          unsigned NumJobs, std::atomic<bool> *HasErrors) {
+  ScopedDisableMsanInterceptorChecks S;
   while (true) {
     unsigned C = (*Counter)++;
     if (C >= NumJobs) break;


        


More information about the llvm-commits mailing list