This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, ARM] Enable libsanitizer


On Thu, Mar 28, 2013 at 11:36 AM, Konstantin Serebryany
<konstantin.s.serebryany@gmail.com> wrote:
> +eugenis@google.com
>
> Hi Christophe,
>
> On Thu, Mar 28, 2013 at 2:09 AM, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
>> Hi,
>> This small patch enables libsanitizer on ARM.
>> It has been tested successfully on cortex-a9 hardware (via the GCC testsuite).
>>
>> I have chosen to bundle -funwind-table with -fsanitize=* so that a
>> useful backtrace can be printed to the user in case of error,
>> otherwise the reporting is limited to one line belonging to
>> libsanitizer.so.
>>
>> Note that the testsuite currently fails when executing under qemu:
>> - support of /proc/self/maps does not conform to the kernel format.
>>   One extra space is missing from some lines, which confuses libsanitizer.
>>   Patch proposed to upstream qemu:
>>   http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg03051.html
>
> As we discussed in
> https://code.google.com/p/address-sanitizer/issues/detail?id=160
> this may be fixed in libsanitizer, although i'd still prefer the qemu fix.
>
>>
>> - qemu reserves some memory space by default, conflicting with
>> libsanitizer needs.
>>   Workaround: invoke qemu with -R 0
>
> Good to know!
>
>>
>> - libsanitizer detects if its output is a tty, and when GCC testsuite
>> is executed under qemu, libsanitizer concludes that it is actually
>> running under a tty, and adds beautyfying characters which confuse
>> dejanu.
>
> Is this again a quemu problem?
> Or should we do some more checks before emitting color codes?
>
> A comment about this patch and a question to Evgeniy:
> on Android/ARM we use zero shadow offset.
> (code.google.com/p/address-sanitizer/wiki/ZeroBasedShadow)
> Can we do it on other ARM targets too?

We do it because newer versions of Android use PIE binaries, and,
combined with other specifics of address space on Linux/ARM, there is
no space for ASan shadow anywhere else. And it's faster.

Zero-based shadow requires PIE. Non-zero-based requires non-PIE on
Android. Is it the same with QEMU? If so, we should switch to
zero-based for uniformity and performance.

>
> --kcc
>
>>
>>
>> OK?
>>
>> Christophe.
>>
>> 2013-03-27  Christophe Lyon <christophe.lyon@linaro.org>
>>
>>     gcc/
>>     * config/arm/arm.c (arm_asan_shadow_offset): New function.
>>     (TARGET_ASAN_SHADOW_OFFSET): Define.
>>     * config/arm/linux-eabi.h (ASAN_CC1_SPEC): Define.
>>     (LINUX_OR_ANDROID_CC): Add ASAN_CC1_SPEC.
>>
>>     libsanitizer/
>>     * configure.tgt: Add ARM pattern.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]