On 9 September 2014 12:03,  <pins...@gmail.com> wrote:
>
>
>> On Sep 9, 2014, at 2:50 AM, Marcus Shawcroft <marcus.shawcr...@gmail.com> 
>> wrote:
>>
>> +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?
>
> Also why 36?  What is the min virtual address space aarch64 Linux kernel 
> supports with 4k pages and 3 level page table?  Also does this need to 
> conditionalized on lp64?  Since I am about to post glibc patches turning on 
> address sanitizer breaks that.
>

The address space is 2^39 according to /proc/self/maps:
[...]

The shadow offset is obtained by dividing this value by 8 -> 2^36.

Note that this value has to match kAArch64_ShadowOffset64 as defined
in libsanitizer/asan/asan_mapping.h.

I do expect a followup patch to support ilp32, but I wouldn't post a
patch which I haven't tested.

Christophe.


> Thanks,
> Andrew
>
>
>
>>
>> Cheers
>> /Marcus
>>
>>
>>> On 5 September 2014 15:49, Christophe Lyon <christophe.l...@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.l...@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.

Reply via email to