Hi Konstantin,

On 26 March 2015 at 18:10, Venkataramanan Kumar
<[email protected]> wrote:
> Hi Konstantin,
>
> On 26 March 2015 at 03:01, Konstantin Serebryany
> <[email protected]> wrote:
>> On Wed, Mar 25, 2015 at 10:23 AM, Venkataramanan Kumar
>> <[email protected]> wrote:
>>> Hi Konstantin/Renato,
>>>
>>>>> The values that define the location of the shadow are initialized at 
>>>>> startup,
>>>>> so it should not be a problem.
>>>>
>>>> Excellent!
>>>>
>>>
>>> The Shadow offset, I need to set "1<<39" for Aarch64 (42 bit VA) and
>>> 1<<36 for Aarch64 (39 bit VA).
>>>
>>> In asan_mapping.h,  it is defined as static const u64
>>> kAArch64_ShadowOffset64 = 1ULL << 36.
>>
>>
>> Why 1ULL << 36 or some other smaller value will not work for both?
>>
>
> On 42 bit VA, I was trying to use 64 bit allocator.
>
> I have to fix the allocator start and size to 0x10000000000. Other
> wise I got the below an assert failures.
>
> COMPILER_CHECK(kSpaceBeg % kSpaceSize == 0)
> COMPILER_CHECK((kRegionSize) >= (1ULL << (SANITIZER_WORDSIZE / 2)))
>
> Putting shadow offset at 2^39 I got HighMemBeg starting at
> 0x10000000000 which also will not interfere with application,
> libraries and the stack.
>
>
>>>
>>> If I understand correctly, I need to initialize this at startup in
>>> both places,  compiler-rt/lib/asan and LLVM 's instrumentation place
>>> lib/Transforms/Instrumentation/AddressSanitizer.cpp ?
>>>
>>>>> The values for Allocator64 have to be compile-time constants for
>>>>> better performance,
>>>>> but  Allocator64 is not going to work on 39 (and probably on 42) bits 
>>>>> anyway.
>>>>> We'll need to use Allocator32.
>>>
>>> For Aarch64 with 42 VA bit I need to turn on Allocator64
>> Why?
>
> ASAN tests passed with 64 bit allocator and with changes I mentioned above.
>
> So I was assuming we can switch 64 bit allocators when we detect 42
> bit VA. But I agree, as we discussed it is not a good thing to do.  It
> should be uniform across all VA and hence 32 bit allocators should be
> default.
>
>>
>>> and for 39
>>> bit VA I need to turn on Allocator32.
>>> ASAN/TSAN does not work when allocator32 is on for 42bit VA.
>>
>> Let's not mix asan and tsan.
>> What's wrong with asan when "allocator32 is on for 42bit VA"?
>
> On 42 bit VA, running a simple stack resuse test case. I got this
> assert failure.
>
> ==24573==AddressSanitizer CHECK failed:
> /home/venkataramanan.kumar/LLVM/TSAN_port/Source/projects/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h:841
> "((res)) < ((kNumPossibleRegions))" (0x3ffb56, 0x80000)
>
> I am looking it into now,

The "kNumPossibleRegions" is defined as per 39 bit VA machine (juno)
as 0x8000000000 (max 39 bit VA) / (2^20) = 0x80000.

On 42 bit I get stack memory reference at 0x3ffb5600000. The region id
computation for the memory  is 0x3ffb5600000/(2^20)  is "0x3ffb56"

Hence the check "((res)) < ((kNumPossibleRegions))" fails.

I have to change the SANITIZER_MMAP_RANGE_SIZE to  1 <<42.

0x40000000000 (max 42 bit VA) / (2^20) = 0x3FFFFF

Now I still find 76 cases still failing and looking at them.


>
>
>>>
>>> So I also need to detect and switch allocator types based on VA.
>>>
>>>
>>> On 25 March 2015 at 22:21, Renato Golin <[email protected]> wrote:
>>>> On 25 March 2015 at 16:41, Konstantin Serebryany
>>>> <[email protected]> wrote:
>>>>> Is it only 39 and 42, or is there a 3-rd option?
>>>>
>>>> As far as I know, only these two.
>>>>
>>>>
>>>>> The values that define the location of the shadow are initialized at 
>>>>> startup,
>>>>> so it should not be a problem.
>>>>
>>>> Excellent!
>>>>
>>>>
>>>>> The values for Allocator64 have to be compile-time constants for
>>>>> better performance,
>>>>> but  Allocator64 is not going to work on 39 (and probably on 42) bits 
>>>>> anyway.
>>>>> We'll need to use Allocator32.
>>>>
>>>> That's our conclusion, too.
>>>>
>>>> I think the next step is to implement the run-time check for AArch64.
>>>>
>>>> Thanks for the help!
>>>>
>>>> cheers,
>>>> --renato
>
> regards,
> Venkat,

regards,
Venkat.

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to