Greg Fitzgerald
2013-Jun-27 19:11 UTC
[LLVMdev] [MSan] false positive from Memory Sanitizer?
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? Thanks, Greg
Evgeniy Stepanov
2013-Jun-28 08:16 UTC
[LLVMdev] [MSan] false positive from Memory Sanitizer?
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