[PATCH] D116634: enable msan-eager-checks with -fsanitize-memory-param-retval.

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 4 21:43:26 PST 2022


vitalybuka added a comment.

this patch depends on D116633 <https://reviews.llvm.org/D116633>, but D116633 <https://reviews.llvm.org/D116633> is useless without this one
a better patch order is :

1. llvm
2. clang
3. compiler-rt (but if it's just test which uses clang flag it should be OK merge with no.2 )

let's do just llvm here, and move clang stuff into D116633 <https://reviews.llvm.org/D116633> with the rest

we should update third_party/llvm/llvm-project/llvm/lib/Passes/PassBuilder.cpp:640
after that we can update third_party/llvm/llvm-project/llvm/test/Instrumentation/MemorySanitizer/msan_eager.ll
with additional ; RUN: line with "-passes='module(msan-module<OPTION_NAME->),function(msan<OPTION_NAME>)" instead of -msan-eager-checks



================
Comment at: compiler-rt/test/msan/noundef_analysis.cpp:5
 // RUN: FileCheck %s < %t.out
+// RUN: %clangxx_msan %s -fsanitize-memory-param-retval -o %t && not %run %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out
----------------
we can land it with driver patch


================
Comment at: llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h:28
   bool Recover;
+  bool EagerChecks;
 };
----------------
maybe we should use CheckParamRetVal something here?



================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:496
         Recover(Options.Recover) {
+    if (Options.EagerChecks) {
+      ClEagerChecks = Options.EagerChecks;
----------------
mllvm is lower level flag, so it should be opposite
-mllvm flag should override MemorySanitizerOptions

with getOptOrDefault below you don't need anything here


================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:676
+      Recover(getOptOrDefault(ClKeepGoing, Kernel || R)),
+      EagerChecks(ClEagerChecks || EagerChecks) {}
 
----------------
EagerChecks(getOptOrDefault(ClEagerChecks, EagerChecks))


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116634



More information about the cfe-commits mailing list