This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Add GetMaxVirtualAddress() support for LoongArch
ClosedPublic

Authored by tangyouling on Nov 1 2022, 6:17 PM.

Details

Summary

Add support for getting the maximum virtual address, LoongArch has multiple
address space layouts, the default maximum virtual address of the current
user space is 47 bits. (from TASK_SIZE in the kernel for loongarch64).

Diff Detail

Event Timeline

tangyouling created this revision.Nov 1 2022, 6:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2022, 6:17 PM
tangyouling requested review of this revision.Nov 1 2022, 6:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2022, 6:17 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
xen0n added inline comments.Nov 1 2022, 6:22 PM
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
1118

I believe you could just add defined(__loongarch__) to the case above and adjust the comments. LoongArch is also an architecture with multiple address space layouts possible.

tangyouling added inline comments.Nov 1 2022, 6:55 PM
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
1118

I believe you could just add defined(__loongarch__) to the case above and adjust the comments. LoongArch is also an architecture with multiple address space layouts possible.

Yes, of course, I will adjust it. Initially just wanted to be consistent with asan_mapping.h (asan only supports 47 bit in loongarch64 for now).

Address @xen0n's comments.

tangyouling retitled this revision from [sanitizer] Add GetMaxVirtualAddress() support for loongarch64 to [sanitizer] Add GetMaxVirtualAddress() support for LoongArch.Nov 1 2022, 7:47 PM
tangyouling edited the summary of this revision. (Show Details)
tangyouling added a reviewer: Restricted Project.
SixWeining added inline comments.Nov 1 2022, 7:54 PM
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
1118
tangyouling added inline comments.Nov 2 2022, 1:17 AM
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
1118

Can this approach applies to
https://reviews.llvm.org/D129418#inline-1243719
https://reviews.llvm.org/D137013#inline-1321523
to support multiple layouts?

Current asan only supports 47-bit address space layout.

SixWeining accepted this revision.Nov 2 2022, 10:28 PM

LGTM. But better to wait for others.

This revision is now accepted and ready to land.Nov 2 2022, 10:28 PM
This revision was landed with ongoing or failed builds.Nov 9 2022, 9:33 PM
This revision was automatically updated to reflect the committed changes.