[LLVMdev] [MSan] false positive from Memory Sanitizer?

Evgeniy Stepanov eugeni.stepanov at gmail.com
Fri Jun 28 01:16:46 PDT 2013


On Thu, Jun 27, 2013 at 11:11 PM, Greg Fitzgerald <garious at gmail.com> wrote:
> In the example below, the Memory Sanitizier (from clang 3.3) reports an error:
>
> #include <math.h>
>
> int main() {
>   double x;
>   (void) modf(0, &x);
>   if (x) {             // Boom
>     return 1;
>   }
>   return 0;
> }
>
> I see that modf() is not implemented by compiler-rt.  Is it possible
> to make the Memory Sanitizer assume that all un-instrumented functions
> initialize any pointers arguments?

It is not clear how to do this (that is, without instrumenting the
uninstrumented functions). Applying this logic to all functions with
external linkage would be too aggressive.

Btw, modf is handled in LLVM ToT.
You could also try MSanDR:
http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msandr/README.txt?view=markup



More information about the llvm-dev mailing list