Git Product home page Git Product logo

Comments (14)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
Could you please run this under gdb and provide the crash stack trace? 

Original comment by [email protected] on 23 Jan 2012 at 7:21

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
btw, I was not able to reproduce this with gflags-1.7 on 64-bit Ubuntu Linux. 
Please provide more detailed info (gdb stack traces and detailed reproducer 
steps)

Original comment by [email protected] on 23 Jan 2012 at 7:55

  • Changed state: Invalid

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
I uses gflags-1.7 on 64-bit CentOS 6.1 (with kernel 2.6.32, same to Ubuntu 
10.04)

the testing program tarball is attached, just run make in the decompressed 
directory to see what happens.

Original comment by [email protected] on 23 Jan 2012 at 8:12

Attachments:

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
Typing 'make all' leads to this: 

clang++ main.cc -I./ -L./so -lgflags -Wl,-rpath,./so -faddress-sanitizer 
-fno-omit-frame-pointer -o dynamic.out
./dynamic.out
hello world!
clang++ main.cc -I./ -L./a -lgflags -faddress-sanitizer -fno-omit-frame-pointer 
-o static.out
./static.out
hello world!


I guess something special in the libc of CentOS 6.1 makes asan fail. 
Need gdb stack trace.... 

Original comment by [email protected] on 23 Jan 2012 at 8:17

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
sorry forgot to post gdb outputs:

$ gdb ./static.out 
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-50.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from 
/home/suhua/codebase/wly.clang/test/asan_with_gflgs/static.out...done.
(gdb) r
Starting program: 
/home/suhua/codebase/wly.clang/test/asan_with_gflgs/static.out 
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x000000000041a40b in __asan_address_is_poisoned ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.47.el6.x86_64 
libgcc-4.4.6-3.el6.x86_64 libstdc++-4.4.6-3.el6.x86_64
(gdb) bt
#0  0x000000000041a40b in __asan_address_is_poisoned ()
#1  0x0000000000417ee6 in __asan::AccessAddress(unsigned long, bool) ()
#2  0x00000000004184d7 in strcmp ()
#3  0x0000003a522be7fe in __cxxabiv1::__vmi_class_type_info::__do_dyncast(long, 
__cxxabiv1::__class_type_info::__sub_kind, __cxxabiv1::__class_type_info 
const*, void const*, __cxxabiv1::__class_type_info const*, void const*, 
__cxxabiv1::__class_type_info::__dyncast_result&) const () from 
/usr/lib64/libstdc++.so.6
#4  0x0000003a522bb3ed in __dynamic_cast () from /usr/lib64/libstdc++.so.6
#5  0x0000003a5227dd2b in bool std::has_facet<std::ctype<char> >(std::locale 
const&) () from /usr/lib64/libstdc++.so.6
#6  0x0000003a522742a4 in std::basic_ios<char, std::char_traits<char> 
>::_M_cache_locale(std::locale const&) ()
   from /usr/lib64/libstdc++.so.6
#7  0x0000003a52274348 in std::basic_ios<char, std::char_traits<char> 
>::init(std::basic_streambuf<char, std::char_traits<char> >*) ()
   from /usr/lib64/libstdc++.so.6
#8  0x0000003a52262de1 in std::ios_base::Init::Init() () from 
/usr/lib64/libstdc++.so.6
#9  0x000000000041314e in __static_initialization_and_destruction_0 ()
    at /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iostream:72
#10 global constructors keyed to _ZN3fLS25FLAGS_tab_completion_wordE() () at 
src/gflags_completions.cc:768
#11 0x0000000000420aa6 in __do_global_ctors_aux ()
#12 0x0000000000407fb3 in _init ()
#13 0x00007fffffffd128 in ?? ()
#14 0x0000000000420a15 in __libc_csu_init ()
#15 0x0000003a45e1ec70 in __libc_start_main () from /lib64/libc.so.6
#16 0x00000000004085f9 in _start ()

Original comment by [email protected] on 23 Jan 2012 at 8:26

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
Yea, initialization problem... 
gflags, which is not built with asan, does it's global CTORs before any 
instrumented code does. The gflags' CTORs call strcmp, which accesses shadow 
memory, but __asan_init has not yet been called. 

We must make sure that __asan_init is called before everything else. 
One option is to build gflags with asan. 
Another option, call __asan_init from preinit array. 

Could you please make an experiment? 
What will happen if you add the following somewhere in your code?

extern "C" void __asan_init();
__attribute__((section(".preinit_array")))
  typeof(__asan_init) *__asan_preinit =__asan_init;



Original comment by [email protected] on 23 Jan 2012 at 8:33

  • Changed state: Accepted

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
I put __asan_init lines in main.cc, and no luck:


clang++ main.cc -I./ -L./so -lgflags -Wl,-rpath,./so -faddress-sanitizer 
-fno-omit-frame-pointer -o dynamic.out
./dynamic.out
ASAN:SIGSEGV
==3525== ERROR: AddressSanitizer crashed on unknown address 0x000000000000 (pc 
0x000000000000 sp 0x7fff46cc6a88 bp 0x7fff46cc6af8 T0)
AddressSanitizer can not provide additional info. ABORTING
Stats: 0M malloced (0M for red zones) by 0 calls
Stats: 0M realloced by 0 calls
Stats: 0M freed by 0 calls
Stats: 0M really freed by 0 calls
Stats: 0M (0 full pages) mmaped in 0 calls
  mmaps   by size class: 
  mallocs by size class: 
  frees   by size class: 
  rfrees  by size class: 
Stats: malloc large: 0 small slow: 0

Original comment by [email protected] on 23 Jan 2012 at 8:38

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
and the static linked version:

clang++ main.cc -I./ -L./a -lgflags -faddress-sanitizer -fno-omit-frame-pointer 
-o static.out
./static.out
ASAN:SIGSEGV
==3538== ERROR: AddressSanitizer crashed on unknown address 0x000000000000 (pc 
0x000000000000 sp 0x7fffc0a03948 bp 0x7fffc0a039b8 T0)
AddressSanitizer can not provide additional info. ABORTING
Stats: 0M malloced (0M for red zones) by 0 calls
Stats: 0M realloced by 0 calls
Stats: 0M freed by 0 calls
Stats: 0M really freed by 0 calls
Stats: 0M (0 full pages) mmaped in 0 calls
  mmaps   by size class: 
  mallocs by size class: 
  frees   by size class: 
  rfrees  by size class: 
Stats: malloc large: 0 small slow: 0

Original comment by [email protected] on 23 Jan 2012 at 8:39

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
gdb stack trace? 

Original comment by [email protected] on 23 Jan 2012 at 9:10

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
$ gdb ./dynamic.out
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-50.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from 
/home/suhua/codebase/wly.clang/test/asan_with_gflgs/dynamic.out...done.
(gdb) r
Starting program: 
/home/suhua/codebase/wly.clang/test/asan_with_gflgs/dynamic.out 
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.47.el6.x86_64 
libgcc-4.4.6-3.el6.x86_64 libstdc++-4.4.6-3.el6.x86_64
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x0000003a4560e552 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2
#2  0x0000003a45600b3a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#3  0x0000000000000001 in ?? ()
#4  0x00007fffffffd41b in ?? ()
#5  0x0000000000000000 in ?? ()

Original comment by [email protected] on 23 Jan 2012 at 9:23

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
$ gdb ./static.out
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-50.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from 
/home/suhua/codebase/wly.clang/test/asan_with_gflgs/static.out...done.
(gdb) r


Starting program: 
/home/suhua/codebase/wly.clang/test/asan_with_gflgs/static.out 
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.47.el6.x86_64 
libgcc-4.4.6-3.el6.x86_64 libstdc++-4.4.6-3.el6.x86_64
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x0000003a4560e552 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2
#2  0x0000003a45600b3a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#3  0x0000000000000001 in ?? ()
#4  0x00007fffffffd41d in ?? ()
#5  0x0000000000000000 in ?? ()

Original comment by [email protected] on 23 Jan 2012 at 9:25

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
Please also try llvm r148726.
I changed the strcmp wrapper, so, if you still have the failure it will likely 
be somewhere else

Original comment by [email protected] on 23 Jan 2012 at 9:25

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
I can not reproduce it and there is a chance that r148726 fixed this. 
Please reopen if you still see this. 

Original comment by [email protected] on 31 Jan 2012 at 12:27

  • Changed state: Fixed

from address-sanitizer.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
Adding Project:AddressSanitizer as part of GitHub migration.

Original comment by [email protected] on 30 Jul 2015 at 9:12

  • Added labels: ProjectAddressSanitizer

from address-sanitizer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.