Re: [PATCH] Handle PIEs in libbacktrace

2013-12-06 Thread Ian Lance Taylor
On Fri, Dec 6, 2013 at 1:53 AM, Jakub Jelinek wrote: > > The alternative would be to just (perhaps under #ifdef SANITIZER_CP_DEMANGLE) > compile in libiberty/cp-demangle.c (similarly how libstdc++ compiles it in) > as part of libsanitizer/libiberty/ or even libsanitizer/libbacktrace/, > and tweak

Re: [PATCH] Handle PIEs in libbacktrace

2013-12-06 Thread Ian Lance Taylor
On Thu, Dec 5, 2013 at 11:50 PM, Jakub Jelinek wrote: > > 2013-12-06 Jakub Jelinek > > * elf.c (ET_DYN): Undefine and define again. > (elf_add): Add exe argument, if true and ehdr.e_type is ET_DYN, > return early -1 without closing the descriptor. > (struct phdr_

Re: [PATCH] Handle PIEs in libbacktrace

2013-12-06 Thread Jakub Jelinek
On Fri, Dec 06, 2013 at 12:53:02PM +0400, Alexey Samsonov wrote: > ASan calls this function only for global variables (not functions). It > is needed because > we use a different machinery to pass global names to ASan runtime - we > register globals > by a call from instrumented code, which also te

Re: [PATCH] Handle PIEs in libbacktrace

2013-12-06 Thread Alexey Samsonov
(now in plain-text mode). ASan calls this function only for global variables (not functions). It is needed because we use a different machinery to pass global names to ASan runtime - we register globals by a call from instrumented code, which also tells runtime the (mangled) global name. OTOH, in

Re: [PATCH] Handle PIEs in libbacktrace

2013-12-06 Thread Dmitry Vyukov
On Fri, Dec 6, 2013 at 12:25 PM, Jakub Jelinek wrote: > On Fri, Dec 06, 2013 at 12:19:45PM +0400, Dmitry Vyukov wrote: >> > And the reason why check-g++ tsan.exp fails even with this patch is >> > that apparently tsan doesn't try to demangle the symbol names, so we get >> > e.g.: >> >> Demangling

Re: [PATCH] Handle PIEs in libbacktrace

2013-12-06 Thread Jakub Jelinek
On Fri, Dec 06, 2013 at 12:19:45PM +0400, Dmitry Vyukov wrote: > > And the reason why check-g++ tsan.exp fails even with this patch is > > that apparently tsan doesn't try to demangle the symbol names, so we get > > e.g.: > > Demangling must be done by the symbolizer. > +samsonov for this So why

Re: [PATCH] Handle PIEs in libbacktrace

2013-12-06 Thread Dmitry Vyukov
On Fri, Dec 6, 2013 at 11:50 AM, Jakub Jelinek wrote: > Hi! > > With the new tsan tests, I've noticed that libbacktrace symbolization > doesn't work when the binary is a PIE. > The problem is that in that case we obviously can't use base_address > of 0, the PIE typically will not have 0 bias, that

[PATCH] Handle PIEs in libbacktrace

2013-12-05 Thread Jakub Jelinek
Hi! With the new tsan tests, I've noticed that libbacktrace symbolization doesn't work when the binary is a PIE. The problem is that in that case we obviously can't use base_address of 0, the PIE typically will not have 0 bias, that is actually the sole point of PIEs that their base address is ran