Code locations from the Memory Sanitizer

Hi all,

I've tried Clang versions 3.6, 3.9 and 5.0 (all installed from Debian
packages on a Debian x86_64 machine), but I still can't get Memory
Sanitizer to give me the error file and line number locations.

The project is

   http://github.com/erikd/libsndfile

and I'm configuring/building it with eg:

    CC=clang-5.0
    CXX=clang++-5.0
    CFLAGS="-fsanitize=memory -fno-omit-frame-pointer -g -Wno-expansion-to-defined"
    CXXFLAGS=$CFLAGS
    ./configure --enable-werror --disable-shared
    make clean all check

and I get:

    broadcast_test : broadcast.rf64 ..........
    Uninitialized bytes in __interceptor_write at offset 36 inside [0x710000000000, 104)
    ==15113==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x67802e (/home/erik/Git/libsndfile/tests/command_test+0x67802e)
    #1 0x600404 (/home/erik/Git/libsndfile/tests/command_test+0x600404)
    #2 0x5f72f6 (/home/erik/Git/libsndfile/tests/command_test+0x5f72f6)
    #3 0x4be48b (/home/erik/Git/libsndfile/tests/command_test+0x4be48b)
    #4 0x4c06d6 (/home/erik/Git/libsndfile/tests/command_test+0x4c06d6)
    #5 0x4b1cfc (/home/erik/Git/libsndfile/tests/command_test+0x4b1cfc)
    #6 0x4a10c6 (/home/erik/Git/libsndfile/tests/command_test+0x4a10c6)
    #7 0x495dbf (/home/erik/Git/libsndfile/tests/command_test+0x495dbf)
    #8 0x7f3f37cf22b0 (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
    #9 0x41ef79 (/home/erik/Git/libsndfile/tests/command_test+0x41ef79)

I expected to get file and line number position as shown in the documentation.

Clues?

Erik

Hi all,

I've tried Clang versions 3.6, 3.9 and 5.0 (all installed from Debian
packages on a Debian x86_64 machine), but I still can't get Memory
Sanitizer to give me the error file and line number locations.

The project is

   http://github.com/erikd/libsndfile

and I'm configuring/building it with eg:

    CC=clang-5.0
    CXX=clang++-5.0
    CFLAGS="-fsanitize=memory -fno-omit-frame-pointer -g -Wno-expansion-to-defined"
    CXXFLAGS=$CFLAGS
    ./configure --enable-werror --disable-shared
    make clean all check

and I get:

    broadcast_test : broadcast.rf64 ..........
    Uninitialized bytes in __interceptor_write at offset 36 inside [0x710000000000, 104)
    ==15113==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x67802e (/home/erik/Git/libsndfile/tests/command_test+0x67802e)
    #1 0x600404 (/home/erik/Git/libsndfile/tests/command_test+0x600404)
    #2 0x5f72f6 (/home/erik/Git/libsndfile/tests/command_test+0x5f72f6)
    #3 0x4be48b (/home/erik/Git/libsndfile/tests/command_test+0x4be48b)
    #4 0x4c06d6 (/home/erik/Git/libsndfile/tests/command_test+0x4c06d6)
    #5 0x4b1cfc (/home/erik/Git/libsndfile/tests/command_test+0x4b1cfc)
    #6 0x4a10c6 (/home/erik/Git/libsndfile/tests/command_test+0x4a10c6)
    #7 0x495dbf (/home/erik/Git/libsndfile/tests/command_test+0x495dbf)
    #8 0x7f3f37cf22b0 (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
    #9 0x41ef79 (/home/erik/Git/libsndfile/tests/command_test+0x41ef79)

I expected to get file and line number position as shown in the documentation.

Clues?

I often need to set the ASAN_SYMBOLIZER_PATH:

https://clang.llvm.org/docs/AddressSanitizer.html#id4

It often tends to be wrong by package default...

HTH
Rainer

Rainer Gerhards wrote:

I often need to set the ASAN_SYMBOLIZER_PATH:

https://clang.llvm.org/docs/AddressSanitizer.html#id4

It often tends to be wrong by package default...

Bingo! In my case, since I'm using Memory Sanitizer I needed to
set MSAN_SYMBOLIZER_PATH rather than ASAN_SYMBOLIZER_PATH.

Thanks for your help Rainer!

Cheers,
Erik

For MSan, you'll need MSAN_SYMBOLIZER_PATH. Or just add to PATH, it
would work for all sanitizers.