This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Use libbacktrace as libsanitizer's symbolizer
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Konstantin Serebryany <konstantin dot s dot serebryany at gmail dot com>
- Cc: Alexey Samsonov <samsonov at google dot com>, Konstantin Serebryany <kcc at gcc dot gnu dot org>, Ian Lance Taylor <iant at google dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 22 Nov 2013 19:57:55 +0100
- Subject: Re: [PATCH] Use libbacktrace as libsanitizer's symbolizer
- Authentication-results: sourceware.org; auth=none
- References: <20131118133930 dot GA892 at tucnak dot redhat dot com> <CAGSYnCMV=Sa6sNq5W-WcB-+iH_f3wwcQyBZ8HMEKsEW7VamHxA at mail dot gmail dot com> <CAGSYnCOs6BHEqfhoBdpF0AEODHhbhLENyWGy_DrObVnUv+js2g at mail dot gmail dot com> <20131118162342 dot GH892 at tucnak dot redhat dot com> <CAGSYnCPcGeYB7EEw=jAFf6h-gc2wJi0hqeZLDPEfmKOjq3FWAA at mail dot gmail dot com> <20131119153350 dot GW892 at tucnak dot redhat dot com> <20131119164221 dot GZ892 at tucnak dot redhat dot com> <CAGSYnCNYcAfhN6k-JFkBbnub2U6=x_VYCuH2K7VhSUf7HZ2FCQ at mail dot gmail dot com> <20131122183452 dot GI892 at tucnak dot redhat dot com> <CAGQ9bdyr8YYs_t=dJSuE=q01A3a7UWB1Qu4DFRV4G970hsOJUw at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Nov 22, 2013 at 10:40:00PM +0400, Konstantin Serebryany wrote:
> [I beg my pardon if this has already been discussed here]
> Does libbacktrace call any functions we intercept (malloc, memset,
> memcpy, strlen, etc)?
> If so, they will have to be un-intercepted there.
Why?
> Our hermetic llvm-symbolizer took as so much work for a reason. :(
> And doing this work for libbacktrace w/o any additional functionality
> for us is kind of sad...
The symbols from libc/libgcc used in my libbacktrace.a are following:
dwarf.o:
U bsearch
U memcpy
U memset
U qsort
U snprintf
U strcmp
U strlen
U strnlen
posix.o:
U close
U __errno_location
U fcntl
U open
print.o:
U fprintf
U fputc
U stderr
U strerror
backtrace.o:
U _Unwind_Backtrace
U _Unwind_GetIPInfo
simple.o:
U _Unwind_Backtrace
U _Unwind_GetIPInfo
elf.o:
U bsearch
U dl_iterate_phdr
U qsort
U strcmp
mmapio.o:
U __errno_location
U getpagesize
U mmap
U munmap
mmap.o:
U __errno_location
U getpagesize
U memcpy
U mmap
Note that I think neither print.o nor backtrace.o nor simple.o
were actually linked into libasan* with my earlier patch, so
the list of external symbols is likely just:
U bsearch
U memcpy
U memset
U qsort
U snprintf
U strcmp
U strlen
U strnlen
U close
U __errno_location
U fcntl
U open
U dl_iterate_phdr
U getpagesize
U mmap
U munmap
Now, what's wrong in using these symbols while symbolizing something?
All the testing worked just fine for me, are you afraid there will be
bugs in libbacktrace which would trigger recursive diagnostics?
Worst case we could build a special copy of libbacktrace.la inside of
libsanitizer rather than just use the target copy of it built for libgo
(libbacktrace right now is used for GCC itself as host library and
for libgo as target library), just by e.g. adding special
libsanitizer/libbacktrace/Makefile.am rules to look for sources into
../../libbacktrace/ and say wrap libbacktrace's internal.h header so
that it #include_next <internal.h> and then redefines the above mentioned
functions or subset of them to the internal stuff.
But before doing that, the question is why.
Jakub