[LLVMbugs] [Bug 17267] New: memory sanitizer reports a false positive? with fts code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 17 07:09:04 PDT 2013


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

            Bug ID: 17267
           Summary: memory sanitizer reports a false positive? with fts
                    code
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: ed0.88.prez at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Hi. I get this problem when executing this code: 
https://raw.github.com/rheit/zdoom/master/tools/zipdir/zipdir.c compiled with
memory sanitizer:

==30138== WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7fdae305ab93 in add_dirs
/home/edward-san/zdoom/trunk/tools/zipdir/zipdir.c:609
    #1 0x7fdae3079227 in main
/home/edward-san/zdoom/trunk/tools/zipdir/zipdir.c:1623
    #2 0x7fdae1dbcea4 in __libc_start_main
/build/buildd/eglibc-2.17/csu/libc-start.c:260
    #3 0x7fdae3057d7c in _start
(/home/edward-san/zdoom/trunk/debug_san/tools/zipdir/zipdir+0x69d7c)
  Uninitialized value was created by a heap allocation
    #0 0x7fdae3026a83 in __interceptor_malloc
/home/edward-san/srcllvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:836
    #1 0x7fdae1e8a56f in fts_alloc /build/buildd/eglibc-2.17/io/fts.c:990
    #2 0x7fdae1e8a56f in fts_open /build/buildd/eglibc-2.17/io/fts.c:143
SUMMARY: MemorySanitizer: use-of-uninitialized-value
/home/edward-san/zdoom/trunk/tools/zipdir/zipdir.c:609 add_dirs
Exiting

I reduced the code to this:

$ cat fts_read_bug.c
#include <fts.h>

int main()
{
    char * const argv[] = {"/usr/local/include", 0};
    FTS *fts;
    FTSENT *ent;

    fts = fts_open(argv, FTS_LOGICAL, 0);

    if (fts == 0)
        return -1;

    ent = fts_read(fts);

    if (ent != 0 &&
        ent->fts_info == FTS_D)
        return 1;

    fts_close(fts);
    return 0;
}

In this case, the message is:
==13273== WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f5b6f7899b5 in main /home/edward-san/llvm/fts_read_bug.c:16
    #1 0x7f5b6e916ea4 in __libc_start_main
/build/buildd/eglibc-2.17/csu/libc-start.c:260
    #2 0x7f5b6f7893fc in _start (/home/edward-san/llvm/a.out+0x683fc)
  Uninitialized value was created by a heap allocation
    #0 0x7f5b6f758103 in __interceptor_malloc
/home/edward-san/srcllvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:836
    #1 0x7f5b6e9e456f in fts_alloc /build/buildd/eglibc-2.17/io/fts.c:990
    #2 0x7f5b6e9e456f in fts_open /build/buildd/eglibc-2.17/io/fts.c:143
SUMMARY: MemorySanitizer: use-of-uninitialized-value
/home/edward-san/llvm/fts_read_bug.c:16 main
Exiting

I have no idea of why it happens.

-- 
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/20130917/ee91e9ff/attachment.html>


More information about the llvm-bugs mailing list