This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, AArch64] Enable Address sanitizer and UB sanitizer
- From: Christophe Lyon <christophe dot lyon at linaro dot org>
- To: Marcus Shawcroft <marcus dot shawcroft at gmail dot com>
- Cc: Andrew Pinski <pinskia at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Patch Tracking <patches at linaro dot org>
- Date: Fri, 26 Sep 2014 15:10:23 +0200
- Subject: Re: [Patch, AArch64] Enable Address sanitizer and UB sanitizer
- Authentication-results: sourceware.org; auth=none
- References: <CAKdteOZq5uYm3eGuy=r5E0rjmLNrszUzOPO57cF6ptTsL_mdmw at mail dot gmail dot com> <CAFqB+PyPsNO=xqNQaSR7YUNDfEn9QhQ0gL+6poc7mcwuS_P=Pg at mail dot gmail dot com> <927F5FF4-E05B-4222-A695-4E07F3FDA5B6 at gmail dot com> <CAKdteOaCh9CuVQJtfzhfhdu6BmG4RnisFQBx512LGyQMr-WziA at mail dot gmail dot com> <CAFqB+Pwn0kELuLt64gh81_FkbBhXz6fOp1W00C93u02BGr4G9w at mail dot gmail dot com> <CAKdteOYSNOTP2FOoRz5Qqr9-nwNz_7peycisOGB-ixc4HLo2pA at mail dot gmail dot com>
On 21 September 2014 20:07, Christophe Lyon <christophe.lyon@linaro.org> wrote:
> On 17 September 2014 12:48, Marcus Shawcroft <marcus.shawcroft@gmail.com> wrote:
>> On 9 September 2014 13:08, Christophe Lyon <christophe.lyon@linaro.org> wrote:
>>> On 9 September 2014 12:03, <pinskia@gmail.com> wrote:
>>>>
>>>>
>>>>> On Sep 9, 2014, at 2:50 AM, Marcus Shawcroft <marcus.shawcroft@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.
>>
>> Presumably for ILP32 the shadow offset should be 1<<29 and we will
>> need to make both asan_mapping.h and aarch64_asan_shadow_offset
>> conditional.
>>
> Indeed. We'll do that once Andrew has committed all his IPL32 patches (glibc).
>
>> This patch for LP64 is OK.
> I will commit it once the libsanitizer runtime has been updated to at
> least r209641 otherwise GCC will fail to build for AArch64.
Committed as r215642.
Christophe.