This is an archive of the discontinued LLVM Phabricator instance.

[msan] LIT: Add lld testing config
ClosedPublic

Authored by lebedev.ri on Dec 2 2017, 6:17 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

lebedev.ri created this revision.Dec 2 2017, 6:17 AM
eugenis added inline comments.Dec 4 2017, 4:49 PM
test/msan/CMakeLists.txt
13 ↗(On Diff #125266)

Where did MSAN_TEST_TARGET_CFLAGS go?

test/msan/dtls_test.c
10 ↗(On Diff #125266)

Do you mean the one on line 49? What does the error message on line 48 say?

lebedev.ri updated this revision to Diff 125523.Dec 5 2017, 7:02 AM
lebedev.ri marked an inline comment as done.

Rebased, added back accidentally lost get_test_cc_for_arch(...).

test/msan/CMakeLists.txt
13 ↗(On Diff #125266)

Oops.

test/msan/dtls_test.c
10 ↗(On Diff #125266)
[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.
eugenis accepted this revision.Dec 5 2017, 3:34 PM
eugenis added inline comments.
test/msan/dtls_test.c
10 ↗(On Diff #125266)

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.

This revision is now accepted and ready to land.Dec 5 2017, 3:34 PM

LLD fixed in r319860.
Please check that you see the same error in the dtls test with and without lld, and remove the XFAIL line.

lebedev.ri updated this revision to Diff 125681.Dec 6 2017, 1:32 AM
lebedev.ri marked 3 inline comments as done.
lebedev.ri edited the summary of this revision. (Show Details)

LLD fixed in r319860.
Please check that you see the same error in the dtls test with and without lld, and remove the XFAIL line.

Yep, i see the same failure now, thanks!

So the msan Unit tests, do they also need these LLD (lto in the future) flavors?

LLD fixed in r319860.
Please check that you see the same error in the dtls test with and without lld, and remove the XFAIL line.

test/msan/dtls_test.c
10 ↗(On Diff #125266)

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?

This is debian sid, amd64.

$ dpkg -l | grep glibc
ii  glibc-doc                                                        2.25-3                            all          GNU C Library: Documentation
ii  glibc-doc-reference                                              2.25-1                            all          GNU C Library: Documentatio

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.

Ooh, nice, so this doubling of the test time actually caught something :)

running unit tests with lld would be useful

This revision was automatically updated to reflect the committed changes.

running unit tests with lld would be useful

Okay, good to know.
I'll try to finish up with LIT tests (asan/???) and then try to go over unittests.