This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: building GLIBC with -fsanitize=address
- From: Konstantin Serebryany <konstantin dot s dot serebryany at gmail dot com>
- To: "Carlos O'Donell" <carlos at redhat dot com>
- Cc: Roland McGrath <roland at hack dot frob dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 26 Sep 2014 14:21:36 -0700
- Subject: Re: building GLIBC with -fsanitize=address
- Authentication-results: sourceware.org; auth=none
- References: <CAGQ9bdzRLKBsAr5wq_9JMZQ388n84dfW+N9ZDuXfFABdbBbpWw at mail dot gmail dot com> <20140827224548 dot B3FA52C3A1A at topped-with-meat dot com> <CAGQ9bdweAV6PifsvBpCMeUeTY=S80yUg338XcBur=zQH-4xhOQ at mail dot gmail dot com> <5407C347 dot 8050803 at redhat dot com> <CAGQ9bdw7QXGP26HXkquzingibJrm2=XaUOcqN69Dy+2fTmWiZA at mail dot gmail dot com> <CAGQ9bdxJh5dzTLvnqaL8HZFw__wOYePqYWNYi_LW+CoiibRVFw at mail dot gmail dot com> <54245782 dot 3090906 at redhat dot com>
On Thu, Sep 25, 2014 at 10:57 AM, Carlos O'Donell <carlos@redhat.com> wrote:
> On 09/23/2014 08:41 PM, Konstantin Serebryany wrote:
>> FTR:
>> here is the compiler wrapper script that tampers with the compiler
>> flags to build
>> ASan-instrumented glibc w/o changing the glibc sources:
>> https://code.google.com/p/address-sanitizer/source/browse/trunk/asan-glibc/asan-glibc-gcc-wrapper.py
>>
>> With this I can build the full glibc (tested on 2.19 and 2.20) with
>> asan instrumentation and find injected bugs.
>> Now I can move further; however it would still be great if someone can
>> assist me with properly patching the glibc build system to support
>> asan build.
>
> Have you been able to make progress on logging instead of faulting on
> error?
>
> We can help with glibc builds, but it would be nice to make sure that
> if we were to turn it on that it won't cause the system to immediately
> abort at boot time when it detects errors.
>
> Recall our conversation at Cauldron 2014, in that ASan + glibc needs to
> log errors as precisely as possible for later offline analysis by the
> distribution team maintaining glibc.
>
> Does that goal still make sense?
Yes, the goal still makes sense.
Today, both GCC and Clang asan implementations have flags to emit
instrumentation via callbacks instead of inline code.
It makes asan somewhat slower, but allows to continue after the first report.
% cat load.c
int load(int *a) { return *a; }
% ~/gcc-inst/bin/gcc -fsanitize=address -O -S -o - --param
asan-instrumentation-with-call-threshold=0 load.c
pushq %rbx
movq %rdi, %rbx
call __asan_load4
movl (%rbx), %eax
popq %rbx
ret
We may need very minor additional changes in asan-run-time, but we
will need them anyway to support whatever kind of logging you need for
glibc.
--kcc
>
> Cheers,
> Carlos.
>