mold icon indicating copy to clipboard operation
mold copied to clipboard

msan failure

Open rui314 opened this issue 3 years ago • 3 comments

Currently, mold fails if compiled with MemorySanitizer. This needs fixing.

$ make -j`nproc` CXX=clang++-14 CXXFLAGS='-fsanitize=memory -g -Og -fno-omit-frame-pointer' LDFLAGS='-fsanitize=memory -fuse-ld=lld' USE_MIMALLOC=0 test
...
SUMMARY: MemorySanitizer: use-of-uninitialized-value /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/fs_path.h:1262:14 in std::filesystem::__cxx11::path::filename() const
Exiting
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile.linux:6: elf/init-array-priorities.sh] Error 1
Testing dead-debug-sections ... ==213403==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55f8bb84bbf1 in std::filesystem::__cxx11::path::filename() const /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/fs_path.h:1262:14
    #1 0x55f8bb84b2dd in main /home/ruiu/mold/main.cc:41:45
    #2 0x7f4dd6309d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
...

rui314 avatar Apr 29 '22 12:04 rui314

I failed to reproduce this in current HEAD (b5bfe4c607b25d19de7d3b451f6ce329a341441b). Has this already been fixed intentionally? or just resolved luckily?

azaika avatar May 19 '22 06:05 azaika

It's still failing on my machine. Maybe it's specific to libstdc++12?

rui314 avatar May 19 '22 07:05 rui314

It (successfully ?) comes to fail on my machine after I removed my libstdc++ and re-installed libstdc++-12.

But to run the msan, I have to add CC=clang-14 to the make options. I finally ran the command below.

make -j`nproc` CC=clang-14 CXX=clang++-14 CXXFLAGS='-fsanitize=memory -g -Og -fno-omit-frame-pointer' LDFLAGS='-fsanitize=memory -fuse-ld=lld' USE_MIMALLOC=0 test

I will try to use libc++ with msan instead of libstdc++ and check whether it fails.

azaika avatar May 19 '22 10:05 azaika