[Patch, AArch64] Enable Address sanitizer and UB sanitizer

Marcus Shawcroft marcus.shawcroft@gmail.com
Tue Sep 9 09:50:00 GMT 2014


+static unsigned HOST_WIDE_INT
+aarch64_asan_shadow_offset (void)
+{
+  return (HOST_WIDE_INT_1 << 36);
+}
+

Looking around various other ports I see magic numbers including 29,
41, 44.... Help me understand why 36 is the right choice for aarch64?

Cheers
/Marcus


On 5 September 2014 15:49, Christophe Lyon <christophe.lyon@linaro.org> wrote:
> Hi,
>
> The attached patch enables the address and undefined behavior sanitizers.
>
> I have tested it on AArch64 hardware, and asan.exp tests pass, but a
> few ubsan.exp tests fail as follows:
> FAIL: c-c++-common/ubsan/float-cast-overflow-1.c   -O3 -g  execution test
> FAIL: c-c++-common/ubsan/float-cast-overflow-1.c   -O2 -flto
> -flto-partition=none  execution test
> FAIL: c-c++-common/ubsan/float-cast-overflow-2.c   -O3 -g  execution test
> FAIL: c-c++-common/ubsan/float-cast-overflow-3.c   -O3 -g  execution test
> FAIL: c-c++-common/ubsan/float-cast-overflow-4.c   -O2  execution test
> FAIL: c-c++-common/ubsan/float-cast-overflow-4.c   -O3 -g  execution test
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O0  (internal compiler error)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O0  (test for excess errors)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O1  (internal compiler error)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O1  (test for excess errors)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O2  (internal compiler error)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O2  (test for excess errors)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O3 -fomit-frame-pointer
> (internal compiler error)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O3 -fomit-frame-pointer
> (test for excess errors)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O3 -g  (internal compiler error)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O3 -g  (test for excess errors)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -Os  (internal compiler error)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -Os  (test for excess errors)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O2 -flto
> -flto-partition=none  (internal compiler error)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O2 -flto
> -flto-partition=none  (test for excess errors)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O2 -flto  (internal
> compiler error)
> FAIL: c-c++-common/ubsan/overflow-int128.c   -O2 -flto  (test for excess errors)
> FAIL: gcc.dg/ubsan/float-cast-overflow-bf.c   -O3 -g  execution test
>
> I think all these failures need to be addressed separately, and should
> not prevent from adding the functionality since most of them pass.
>
> Note that an update of libsanitizer is required, to include at least
> revision 209641 (which fixes internal_fork for AArch64).
>
> OK for trunk?
>
> Christophe.
>
> 2014-09-05  Christophe Lyon <christophe.lyon@linaro.org>
>         gcc/
>         * config/aarch64/aarch64-linux.h (ASAN_CC1_SPEC): Define.
>         (CC1_SPEC): Define.
>         * config/aarch64/aarch64.c (aarch64_asan_shadow_offset): New function.
>         (TARGET_ASAN_SHADOW_OFFSET): Define.
>
>         libsanitizer/
>         * configure.tgt: Add AArch64 pattern.



More information about the Gcc-patches mailing list