[PATCH] D40768: [msan] LIT: Add lld testing config

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 15:34:17 PST 2017


eugenis accepted this revision.
eugenis added inline comments.
This revision is now accepted and ready to land.


================
Comment at: test/msan/dtls_test.c:10
 
+// Fails with assert(handle != 0); with LLD.
+// XFAIL: lld
----------------
lebedev.ri wrote:
> eugenis wrote:
> > Do you mean the one on line 49? What does the error message on line 48 say?
> ```
> [6/7] Running the MemorySanitizer tests
> FAIL: MemorySanitizer-X86_64 :: dtls_test.c (618 of 842)
> ******************** TEST 'MemorySanitizer-X86_64 :: dtls_test.c' FAILED ********************
> Script:
> --
> /build/llvm-build-Clang-release/./bin/clang  -fsanitize=memory -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls    -gline-tables-only -g /build/compiler-rt/test/msan/dtls_test.c -o /build/llvm-build-Clang-release/projects/compiler-rt/test/msan/X86_64/Output/dtls_test.c.tmp
> /build/llvm-build-Clang-release/./bin/clang  -fsanitize=memory -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls    -gline-tables-only -g /build/compiler-rt/test/msan/dtls_test.c -DBUILD_SO -fPIC -o /build/llvm-build-Clang-release/projects/compiler-rt/test/msan/X86_64/Output/dtls_test.c.tmp-so.so -shared
> /build/llvm-build-Clang-release/projects/compiler-rt/test/msan/X86_64/Output/dtls_test.c.tmp 2>&1
> --
> Exit Code: 77
> 
> Command Output (stdout):
> --
> ==5943==WARNING: MemorySanitizer: use-of-uninitialized-value
>     #0 0x48d683 in Thread1 /build/compiler-rt/test/msan/dtls_test.c:22:7
>     #1 0x7f223997f518 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7518)
>     #2 0x7f2238d7ca5e in clone (/lib/x86_64-linux-gnu/libc.so.6+0xeca5e)
> 
> SUMMARY: MemorySanitizer: use-of-uninitialized-value /build/compiler-rt/test/msan/dtls_test.c:22:7 in Thread1
> Exiting
> 
> --
> 
> ********************
> FAIL: MemorySanitizer-lld-X86_64 :: dtls_test.c (749 of 842)
> ******************** TEST 'MemorySanitizer-lld-X86_64 :: dtls_test.c' FAILED ********************
> Script:
> --
> /build/llvm-build-Clang-release/./bin/clang  -fsanitize=memory -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls   -fuse-ld=lld  -gline-tables-only -g /build/compiler-rt/test/msan/dtls_test.c -o /build/llvm-build-Clang-release/projects/compiler-rt/test/msan/lld-X86_64/Output/dtls_test.c.tmp
> /build/llvm-build-Clang-release/./bin/clang  -fsanitize=memory -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls   -fuse-ld=lld  -gline-tables-only -g /build/compiler-rt/test/msan/dtls_test.c -DBUILD_SO -fPIC -o /build/llvm-build-Clang-release/projects/compiler-rt/test/msan/lld-X86_64/Output/dtls_test.c.tmp-so.so -shared
> /build/llvm-build-Clang-release/projects/compiler-rt/test/msan/lld-X86_64/Output/dtls_test.c.tmp 2>&1
> --
> Exit Code: 134
> 
> Command Output (stdout):
> --
> /build/llvm-build-Clang-release/projects/compiler-rt/test/msan/lld-X86_64/Output/dtls_test.c.tmp-so.so: undefined symbol: __msan_retval_tls
> dtls_test.c.tmp: /build/compiler-rt/test/msan/dtls_test.c:44: int main(int, char **): Assertion `handle != 0' failed.
> 
> --
> Command Output (stderr):
> --
> /build/llvm-build-Clang-release/projects/compiler-rt/test/msan/lld-X86_64/Output/dtls_test.c.script: line 3:  9429 Aborted                 /build/llvm-build-Clang-release/projects/compiler-rt/test/msan/lld-X86_64/Output/dtls_test.c.tmp 2>&1
> 
> --
> 
> ********************
> Testing Time: 45.72s
> ********************
> Failing Tests (2):
>     MemorySanitizer-X86_64 :: dtls_test.c
>     MemorySanitizer-lld-X86_64 :: dtls_test.c
> 
>   Expected Passes    : 838
>   Expected Failures  : 2
>   Unexpected Failures: 2
> FAILED: projects/compiler-rt/test/msan/CMakeFiles/check-msan 
> cd /build/llvm-build-Clang-release/projects/compiler-rt/test/msan && /usr/bin/python2.7 /build/llvm-build-Clang-release/./bin/llvm-lit -sv /build/llvm-build-Clang-release/projects/compiler-rt/test/msan/X86_64 /build/llvm-build-Clang-release/projects/compiler-rt/test/msan/lld-X86_64 /build/llvm-build-Clang-release/projects/compiler-rt/test/msan/Unit
> ninja: build stopped: subcommand failed.
> ```
The first failure means that dtls handling in sanitizer_common is broken on your machine. Must be a new or otherwise unsupported glibc version. It's a mess. Out of curiosity, what is your version?

The second is even more interesting. LLD does not re-export msan interface symbols from executables. Compare objdump -T path/to/binary | grep  __msan with and without lld. It's a dumb bug in lld, it's great that we caught it. I'll fix.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D40768





More information about the llvm-commits mailing list