Boost logo

Boost :

Subject: Re: [boost] Test failures on sanitize memory - are they caused by lightweight_test?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-03-11 05:43:21


 On Wed, Mar 11, 2015 at 12:32 PM, Fletcher, John P
<j.p.fletcher_at_[hidden]> wrote:
> There is a test set on develop called BenPope x86_64 Ubuntu - phoenix - adapt_function / clang-linux-3.6~msan~c14_libc++
>
> This runs this command line for example on the Phoenix test "adapt_function":
>
> "clang++-3.6" -c -x c++ -std=c++1y -stdlib=libc++ -fsanitize=memory -O0 -fno-inline -Wall -fPIC -m64 -DBOOST_ALL_NO_LIB=1 -I".." -o "/home/ben/development/boost/test/build/develop/results/boost/bin.v2/libs/phoenix/test/adapt_function.test/clang-linux-3.6~msan~c14_libc++/debug/address-model-64/architecture-x86/debug-symbols-off/function/adapt_function.o" "../libs/phoenix/test/function/adapt_function.cpp"
>
> There are numerous failures with this test set on Phoenix and I set out to find out why.
>
> Most of the failures are like this:
>
> SUMMARY: MemorySanitizer: use-of-uninitialized-value ??:0 std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long)
> Exiting
>
> I think this is coming from the boost::report_errors function defined in boost/core/lightweight_test.hpp
>
> I have put some temporary tests on to develop for Phoenix which contain only various calls to test the lightweight test. These are called aa_test0 to 3 so they will come at the top of the table. Unfortunately tests are not reporting at the moment so I don't have any results.
>
> There are also failures on the testing of Boost Core with the same test set.
>
> I thought I would report this without waiting for the results in the hope that it can be sorted out for the 1.58.0 release.

This looks like a string insertion operator implementation. I don't
see how the string memory could be uninitialized since there are only
literals used in report_errors(), as well as other functions, unless
you use BOOST_ERROR with uninitialized buffer as the message string. I
suspect a false positive. Does MSan report an error for this code
sample:

 #include <iostream>

 int main()
 {
   std::cerr << "Hello, world!" << std::endl;
   return 0;
 }


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk