[PATCH] D61163: [libFuzzer] Disable MSan interceptors in SIGINT handler.

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 17:15:56 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT359254: [libFuzzer] Disable MSan interceptors in SIGINT handler. (authored by morehouse, committed by ).
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

Changed prior to commit:
  https://reviews.llvm.org/D61163?vs=196759&id=196765#toc

Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61163/new/

https://reviews.llvm.org/D61163

Files:
  lib/fuzzer/FuzzerLoop.cpp
  test/fuzzer/sigint.test


Index: lib/fuzzer/FuzzerLoop.cpp
===================================================================
--- lib/fuzzer/FuzzerLoop.cpp
+++ lib/fuzzer/FuzzerLoop.cpp
@@ -266,6 +266,7 @@
 void Fuzzer::InterruptCallback() {
   Printf("==%lu== libFuzzer: run interrupted; exiting\n", GetPid());
   PrintFinalStats();
+  ScopedDisableMsanInterceptorChecks S; // RmDirRecursive may call opendir().
   RmDirRecursive(TempPath(".dir"));
   // Stop right now, don't perform any at-exit actions.
   _Exit(Options.InterruptExitCode);
@@ -681,7 +682,7 @@
         Size <= CurrentMaxMutationLen)
       NewSize = MD.MutateWithMask(CurrentUnitData, Size, Size,
                                   II.DataFlowTraceForFocusFunction);
-    
+
     // If MutateWithMask either failed or wasn't called, call default Mutate.
     if (!NewSize)
       NewSize = MD.Mutate(CurrentUnitData, Size, CurrentMaxMutationLen);
Index: test/fuzzer/sigint.test
===================================================================
--- test/fuzzer/sigint.test
+++ test/fuzzer/sigint.test
@@ -0,0 +1,17 @@
+# FIXME: Disabled on Windows for now because of reliance on posix only features
+# (eg: export, "&", pkill).
+UNSUPPORTED: darwin, windows
+
+# Check that libFuzzer exits gracefully under SIGINT with MSan.
+RUN: rm -rf %t
+RUN: mkdir -p %t
+RUN: %msan_compiler %S/SleepOneSecondTest.cpp -o %t/LFSIGINT
+
+RUN: %run %t/LFSIGINT 2> %t/log & export PID=$!
+RUN: sleep 2
+RUN: kill -SIGINT $PID
+RUN: sleep 3
+RUN: cat %t/log | FileCheck %s
+
+CHECK: libFuzzer: run interrupted; exiting
+CHECK-NOT: WARNING: MemorySanitizer


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61163.196765.patch
Type: text/x-patch
Size: 1586 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190426/4c81f4e4/attachment.bin>


More information about the llvm-commits mailing list