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, AArch64] Enable Address sanitizer and UB sanitizer


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.


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