[LLVMbugs] [Bug 17377] New: MemorySanitizer false positive in module destructors

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 26 01:07:54 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17377

            Bug ID: 17377
           Summary: MemorySanitizer false positive in module destructors
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: eugeni.stepanov at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat 1.cc
#include <stdio.h>
#include <stdlib.h>
class A {
public:
    ~A() {
        if (this)
            exit(1);
    }
};

A a;

__attribute__((noinline))
void f(long x) {
}

int main(void) {
    long  x;
    long * volatile p = &x;
    f(*p);
    return 0;    
}

$ ./build/bin/clang++ -fsanitize=memory 1.cc -o 1 -O0 -g
$ MSAN_SYMBOLIZER_PATH=build/bin/llvm-symbolizer ./1
==19875== WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f5818982037 in A::~A() /code/llvm/1.cc:6
    #1 0x7f5818981fbd in A::~A() /code/llvm/1.cc:5
    #2 0x7f581754b900 in __run_exit_handlers
/build/buildd/eglibc-2.15/stdlib/exit.c:78
    #3 0x7f581754b984 in __GI_exit /build/buildd/eglibc-2.15/stdlib/exit.c:100
    #4 0x7f5817531773 in __libc_start_main
/build/buildd/eglibc-2.15/csu/libc-start.c:258
    #5 0x7f5818981cf0 in _start (/code/llvm/1+0x52cf0)

The cause is obvious: module destructors get stale argument shadow due to being
called from (uninstrumented) libc.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130926/a644f2b4/attachment.html>


More information about the llvm-bugs mailing list