This is an archive of the discontinued LLVM Phabricator instance.

[asan] Enable ASan for AArch64/42-bit VMA
ClosedPublic

Authored by zatrazz on Aug 19 2015, 10:16 AM.

Details

Summary

This patch adds support for asan on aarch64-linux with 42-bit VMA
(current default config for 64K pagesize kernels). The support is
enabled by defining the SANITIZER_AARCH64_VMA to 42 at build time
for both clang/llvm and compiler-rt. The default VMA is 39 bits.

For 42-bit VMA aarch64 uses SANITIZIER_CAN_USER_ALLOCATOR64.

llvm related patch: http://reviews.llvm.org/D12159

Diff Detail

Event Timeline

zatrazz updated this revision to Diff 32569.Aug 19 2015, 10:16 AM
zatrazz retitled this revision from to [asan] Enable ASan for AArch64/42-bit VMA.
zatrazz updated this object.
zatrazz added reviewers: kcc, eugenis, rengolin, dvyukov.
zatrazz added a subscriber: llvm-commits.
rengolin added inline comments.Aug 19 2015, 10:27 AM
lib/sanitizer_common/sanitizer_platform.h
85

You haven't added any logic for 48 bits. Would it be simple to do it?

89

Would also be good to have some kind of failsafe (#error) for when users choose a VMA that is not supported.

zatrazz added inline comments.Aug 19 2015, 12:27 PM
lib/sanitizer_common/sanitizer_platform.h
85

Yes, for ASAN it will be since the only requirement is the 'kAArch64_ShadowOffset64' (which I think it should be 1<< 45). I have not added it because I have no system to actually test it.

89

Right, I will add it.

rengolin added inline comments.Aug 19 2015, 12:32 PM
lib/sanitizer_common/sanitizer_platform.h
85

Thought as much. But it's odd to mention and not do anything.

Maybe add a "(unsupported)" right after the number 48 in the comment would clear the confusion.

eugenis added inline comments.Aug 19 2015, 12:33 PM
lib/sanitizer_common/sanitizer_platform.h
120

Does this say that mmap range for 39-bit VMA is 40 bit? That's probably not correct.

zatrazz added inline comments.Aug 19 2015, 1:22 PM
lib/sanitizer_common/sanitizer_platform.h
120

It is not, although I have not seen any mmap failures in testcase for 39-bit VMA. I will change it anyway.

eugenis added inline comments.Aug 19 2015, 1:27 PM
lib/sanitizer_common/sanitizer_platform.h
120

I believe this will not cause any test failures. It will waste some memory though, by inflating the large allocator's bitmap.

zatrazz updated this revision to Diff 32685.Aug 20 2015, 5:27 AM

Updated patch based on reviews comments:

  • Add a failsafe SANITIZER_AARCH64_VMA test to bail out for invalid values
  • Correct the mmap limits for 39-bit VMA
rengolin edited edge metadata.Aug 20 2015, 5:32 AM

"(unsupported)" comment for 48 bits.

Why does this depend on SANITIZER_LINUX and the LLVM side doesn't?

rengolin accepted this revision.Aug 20 2015, 5:40 AM
rengolin edited edge metadata.

Why does this depend on SANITIZER_LINUX and the LLVM side doesn't?

Ignore me. LGTM with the extra unsupported comment.

This revision is now accepted and ready to land.Aug 20 2015, 5:40 AM
zatrazz closed this revision.Aug 21 2015, 6:38 AM