On 17 September 2014 12:48, Marcus Shawcroft <marcus.shawcr...@gmail.com> wrote: > On 9 September 2014 13:08, Christophe Lyon <christophe.l...@linaro.org> wrote: >> 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. > > 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. > Thanks > /Marcus