• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Subject: Address Sanitizer and out-of-project libraries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subject: Address Sanitizer and out-of-project libraries


  • Subject: Re: Subject: Address Sanitizer and out-of-project libraries
  • From: Sean McBride <email@hidden>
  • Date: Fri, 22 Jan 2016 16:43:05 -0500
  • Organization: Rogue Research Inc.

On Fri, 22 Jan 2016 13:00:42 -0800, Anna Zaks said:

>However, there is one corner case in C++ container overflow checking,
>where this might not always hold. Specifically, if libc++ containers
>cross from instrumented (rebuilt with ASan) to non-instrumented code,
>Address Sanitizer might report container overflow false positives.
>(Imagine two libraries, both using the same std::vector, only one of
>them is instrumented. Push_back from the non-instrumented module will
>not mark the memory for the newly added element as valid. Accessing the
>element from the instrumented code, would trigger a false positive report.)

Oh that sounds like it!

Our problem:
 - involves C++
 - involves std::vector
 - started when we switched from libstdc++ to libc++

>What do these crashes look like? Are they C++ container overflow reports?

Our Xcode-built app crashes at launch (with ASan) when some CMake-built (without ASan) C++ library code constructs a global variable.  Before main(), starting from __cxx_global_var_init2(), we get a exc_bad_access at address=0x1.  The typical backtrace is:

#0	0x00000001044cf120 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:2074
#1	0x00000001044cf10b in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:2075
#2	0x00000001044cf0ef in void std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::construct<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1673
#3	0x00000001044cf0be in void std::__1::allocator_traits<std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::__construct<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::integral_constant<bool, true>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1600
#4	0x00000001044cf086 in void std::__1::allocator_traits<std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::construct<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1453
#5	0x00000001044cf04e in std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::push_back(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:1609
#6	0x00000001044cef6d in gdcm::GlobalInternal::LoadDefaultPaths() at /Users/builder/official_builds/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary/gdcmGlobal.cxx:63
#7	0x00000001044cc53f in gdcm::Global::Global() at /Users/builder/official_builds/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary/gdcmGlobal.cxx:88
#8	0x00000001044cc3c5 in gdcm::Global::Global() at /Users/builder/official_builds/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary/gdcmGlobal.cxx:75
#9	0x0000000103dcd1a4 in ::__cxx_global_var_init2() at /Users/builder/official_builds/ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary/gdcmGlobal.h:103

And indeed the bloody global is in a .h file, which I suppose means it'll show up in translation units built both with and without ASan.

>Please, file a radar and provide us with more information about your
>project, the libraries you link against, and the crashes you are seeing.
>Attaching a project that would allow us to reproduce the issue would be
>the most helpful.

I think perhaps the mystery is solved.  If I rebuild everything with ASan, then the problem will probably go away, right?  Will try than on Monday.

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Re: Subject: Address Sanitizer and out-of-project libraries (From: Anna Zaks <email@hidden>)

  • Prev by Date: Re: Subject: Address Sanitizer and out-of-project libraries
  • Next by Date: Re: Xcode server - where are build bots stored?
  • Previous by thread: Re: Subject: Address Sanitizer and out-of-project libraries
  • Next by thread: Can a command-line tool have a bundle ID?
  • Index(es):
    • Date
    • Thread