Bug#904116: clang-6.0: Memory sanitiser false positives
Olly Betts
olly at survex.com
Fri Jul 20 00:25:19 BST 2018
Package: clang-6.0
Version: 1:6.0.1-2
Severity: normal
The attached reduced testcase gives a false positive with memory
sanitiser:
Uninitialized bytes in __interceptor_memcmp at offset 0 inside [0x7ffc2bd76598, 1)
==16008==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x7fe07c37b069 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x120069)
#1 0x49a6be in bool std::operator==<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:6075:20
#2 0x49a612 in bool std::operator!=<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:6113:22
#3 0x49a3f9 in main /home/olly/git/xapian-1.4/xapian-core/tests/memsanfalsepositive.cc:5:41
#4 0x7fe07bee0b16 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x22b16)
#5 0x41e349 in _start (/home/olly/git/xapian-1.4/xapian-core/tests/a.out+0x41e349)
SUMMARY: MemorySanitizer: use-of-uninitialized-value (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x120069) in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const
Exiting
I suspect the problem might be that libstdc++ needs to be built with
memory sanitiser too - the documentation at
https://clang.llvm.org/docs/MemorySanitizer.html#limitations notes:
| MemorySanitizer requires that all program code is instrumented. This
| also includes any libraries that the program depends on, even libc.
| Failing to achieve this may result in false reports.
(I get what appears to be the same error if I use clang-7
1:7~svn331965-1 instead, but since that seems to be an SVN snapshot
version, I've reported this against the stable release version).
Cheers,
Olly
-- System Information:
Debian Release: buster/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.16.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8), LANGUAGE=en_NZ:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages clang-6.0 depends on:
ii binutils 2.31.1-1
ii libc6 2.27-5
ii libc6-dev 2.27-5
ii libclang-common-6.0-dev 1:6.0.1-2
ii libclang1-6.0 1:6.0.1-2
ii libgcc-7-dev 7.3.0-26
ii libgcc1 1:8.1.0-11
ii libjsoncpp1 1.7.4-3
ii libllvm6.0 1:6.0.1-2
ii libobjc-7-dev 7.3.0-26
ii libstdc++-7-dev 7.3.0-26
ii libstdc++6 8.1.0-11
Versions of packages clang-6.0 recommends:
ii libomp-dev 6.0.1-1
ii llvm-6.0-dev 1:6.0.1-2
ii python 2.7.15-3
Versions of packages clang-6.0 suggests:
pn clang-6.0-doc <none>
pn gnustep <none>
pn gnustep-devel <none>
-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: memsanfalsepositive.cc
Type: text/x-c++src
Size: 122 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-llvm-team/attachments/20180720/1c90d535/attachment.cc>
More information about the Pkg-llvm-team
mailing list