public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/56393] New: SIGSEGV when -fsanitize=address and dynamic lib with global objects
@ 2013-02-19 13:02 t-gcc-bugzilla at snowelm dot com
  2013-02-19 13:50 ` [Bug sanitizer/56393] " kcc at gcc dot gnu.org
                   ` (43 more replies)
  0 siblings, 44 replies; 45+ messages in thread
From: t-gcc-bugzilla at snowelm dot com @ 2013-02-19 13:02 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56393

             Bug #: 56393
           Summary: SIGSEGV when -fsanitize=address and dynamic lib with
                    global objects
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: t-gcc-bugzilla@snowelm.com
                CC: dodji@gcc.gnu.org, dvyukov@gcc.gnu.org,
                    jakub@gcc.gnu.org, kcc@gcc.gnu.org


Created attachment 29493
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29493
gdb session log

When linked with a dynamic library with a globally initialized class object, a
compiled code with address sanitizer dies with SIGSEGV.  I think this is a 
typical usecase...

Test case: 
(boost 1.53 was installed with --build-type=complete.
 tested by libs compiled with g++ 4.7.2 as well as libs compiled with head gcc)
---------------------------------
#include <boost/thread/shared_mutex.hpp>
#include <cstdio>
int main() {
    printf("hello\n");
    boost::upgrade_mutex m;
}
----------------------------------

$ g++ -g -fsanitize=address -I/usr/local/include hoge2.cpp -o a.out
-lboost_thread -lboost_system
$ ./a.out
Segmentation fault (core dumped)

The segfault is before the printf.
Without -fsanitize=address it runs normally.  If the program is linked with
static libs (-lboost_thread-mt-s -lboost_system-mt-s), it runs normally.
Note that the libraries are compiled without -fsanitize=address.

I investigated the situation by gdb (with -lboost_thread-mt-d
-lboost_system-mt-d). Please see the attached log.
For me it seems that some initializer in the shared lib kicks sanitized code of
some object constructor before the sanitizer gets ready.


^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2014-09-30  8:36 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-19 13:02 [Bug sanitizer/56393] New: SIGSEGV when -fsanitize=address and dynamic lib with global objects t-gcc-bugzilla at snowelm dot com
2013-02-19 13:50 ` [Bug sanitizer/56393] " kcc at gcc dot gnu.org
2013-02-19 14:02 ` t-gcc-bugzilla at snowelm dot com
2013-02-19 14:11 ` kcc at gcc dot gnu.org
2013-02-19 15:23 ` t-gcc-bugzilla at snowelm dot com
2013-02-19 15:27 ` t-gcc-bugzilla at snowelm dot com
2013-02-19 18:34 ` kcc at gcc dot gnu.org
2013-02-19 20:38 ` eugeni.stepanov at gmail dot com
2013-02-20 14:30 ` kcc at gcc dot gnu.org
2013-02-20 14:43 ` jakub at gcc dot gnu.org
2013-02-20 14:50 ` kcc at gcc dot gnu.org
2013-02-20 14:57 ` eugeni.stepanov at gmail dot com
2013-02-20 15:03 ` jakub at gcc dot gnu.org
2013-02-20 18:30 ` eugeni.stepanov at gmail dot com
2013-02-21 10:54 ` amonakov at gcc dot gnu.org
2013-02-21 11:36 ` kcc at gcc dot gnu.org
2013-02-21 11:52 ` eugeni.stepanov at gmail dot com
2013-02-22  6:39 ` t-gcc-bugzilla at snowelm dot com
2013-02-22  6:56 ` pinskia at gcc dot gnu.org
2013-02-22  7:02 ` kcc at gcc dot gnu.org
2013-02-22  9:02 ` t-gcc-bugzilla at snowelm dot com
2013-02-22 16:08 ` jakub at gcc dot gnu.org
2013-04-07  8:44 ` david.abdurachmanov at gmail dot com
2013-04-08  6:32 ` kcc at gcc dot gnu.org
2013-04-08  6:56 ` jakub at gcc dot gnu.org
2013-06-01 21:35 ` david.abdurachmanov at gmail dot com
2013-06-03  7:56 ` kcc at gcc dot gnu.org
2013-10-15 13:39 ` y.gribov at samsung dot com
2013-10-15 13:54 ` eugeni.stepanov at gmail dot com
2013-10-15 14:02 ` pluto at agmk dot net
2013-10-15 14:04 ` eugeni.stepanov at gmail dot com
2013-10-15 17:43 ` tetra2005 at gmail dot com
2013-10-15 17:45 ` tetra2005 at gmail dot com
2013-10-15 17:52 ` eugeni.stepanov at gmail dot com
2013-10-15 18:04 ` tetra2005 at gmail dot com
2013-10-16 12:05 ` y.gribov at samsung dot com
2013-10-16 13:29 ` y.gribov at samsung dot com
2013-10-16 13:44 ` eugeni.stepanov at gmail dot com
2013-10-16 14:02 ` y.gribov at samsung dot com
2013-10-30  7:53 ` jakub at gcc dot gnu.org
2013-10-30  8:12 ` y.gribov at samsung dot com
2013-10-30  8:14 ` y.gribov at samsung dot com
2013-10-30  8:23 ` jakub at gcc dot gnu.org
2013-10-30  9:38 ` y.gribov at samsung dot com
2014-09-30  8:36 ` y.gribov at samsung dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).