This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Handle PIEs in libbacktrace
- From: Alexey Samsonov <samsonov at google dot com>
- To: Dmitry Vyukov <dvyukov at google dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Ian Lance Taylor <iant at google dot com>, Konstantin Serebryany <konstantin dot s dot serebryany at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 6 Dec 2013 12:53:02 +0400
- Subject: Re: [PATCH] Handle PIEs in libbacktrace
- Authentication-results: sourceware.org; auth=none
- References: <20131206075033 dot GE892 at tucnak dot redhat dot com> <CACT4Y+b4Txm5oWOCEC71OmU5+4sbxgpkx=6ziiXD7DPfBrpeoA at mail dot gmail dot com> <20131206082507 dot GF892 at tucnak dot redhat dot com> <CACT4Y+bn6bPbqcX4TghnQBKUe=JtVbxxrtKxA--z-5399hKUeg at mail dot gmail dot com>
(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 TSan we rely on symbolization to demangle names of global variables.
>
> From what I can see, even when
> you are using llvm-symbolizer, sanitizer_common doesn't pass -demangle
> option to it.
-demangle defaults to "on" in llvm-symbolizer.
On Fri, Dec 6, 2013 at 12:51 PM, Dmitry Vyukov <dvyukov@google.com> wrote:
> On Fri, Dec 6, 2013 at 12:25 PM, Jakub Jelinek <jakub@redhat.com> 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 must be done by the symbolizer.
>>> +samsonov for this
>>
>> So why does asan_report.cc have then:
>> static const char *MaybeDemangleGlobalName(const char *name) {
>> // We can spoil names of globals with C linkage, so use an heuristic
>> // approach to check if the name should be demangled.
>> return (name[0] == '_' && name[1] == 'Z')
>> ? Symbolizer::Get()->Demangle(name)
>> : name;
>> }
>> and uses it where it wants to demangle?
>
> I would say this is a defect. It's symbolizer responsibility.
>
>> From what I can see, even when
>> you are using llvm-symbolizer, sanitizer_common doesn't pass -demangle
>> option to it.
>
>
> It defaults to true:
> static cl::opt<bool>
> ClDemangle("demangle", cl::init(true), cl::desc("Demangle function names"));
--
Alexey Samsonov, MSK