forked from OSchip/llvm-project
(NFC) Rename GetMax{,User}VirtualAddress.
Future change will introduce GetMaxVirtualAddress that will not take the kernel area into account. llvm-svn: 317638
This commit is contained in:
parent
367ca01478
commit
0379d3f844
|
@ -28,7 +28,7 @@
|
|||
namespace __asan {
|
||||
|
||||
// The system already set up the shadow memory for us.
|
||||
// __sanitizer::GetMaxVirtualAddress has already been called by
|
||||
// __sanitizer::GetMaxUserVirtualAddress has already been called by
|
||||
// AsanInitInternal->InitializeHighMemEnd (asan_rtl.cc).
|
||||
// Just do some additional sanity checks here.
|
||||
void InitializeShadowMemory() {
|
||||
|
|
|
@ -307,7 +307,7 @@ static void asan_atexit() {
|
|||
|
||||
static void InitializeHighMemEnd() {
|
||||
#if !ASAN_FIXED_MAPPING
|
||||
kHighMemEnd = GetMaxVirtualAddress();
|
||||
kHighMemEnd = GetMaxUserVirtualAddress();
|
||||
// Increase kHighMemEnd to make sure it's properly
|
||||
// aligned together with kHighMemBeg:
|
||||
kHighMemEnd |= SHADOW_GRANULARITY * GetMmapGranularity() - 1;
|
||||
|
|
|
@ -280,7 +280,7 @@ void InitShadow() {
|
|||
CHECK_EQ(0, GetShadow());
|
||||
CHECK_EQ(0, GetShadowSize());
|
||||
|
||||
uptr vma = GetMaxVirtualAddress();
|
||||
uptr vma = GetMaxUserVirtualAddress();
|
||||
// Shadow is 2 -> 2**kShadowGranularity.
|
||||
SetShadowSize((vma >> (kShadowGranularity - 1)) + 1);
|
||||
VReport(1, "CFI: VMA size %zx, shadow size %zx\n", vma, GetShadowSize());
|
||||
|
|
|
@ -120,7 +120,7 @@ bool InitShadow(bool init_origins) {
|
|||
return false;
|
||||
}
|
||||
|
||||
const uptr maxVirtualAddress = GetMaxVirtualAddress();
|
||||
const uptr maxVirtualAddress = GetMaxUserVirtualAddress();
|
||||
|
||||
for (unsigned i = 0; i < kMemoryLayoutSize; ++i) {
|
||||
uptr start = kMemoryLayout[i].start;
|
||||
|
|
|
@ -73,7 +73,7 @@ INLINE uptr GetPageSizeCached() {
|
|||
return PageSizeCached;
|
||||
}
|
||||
uptr GetMmapGranularity();
|
||||
uptr GetMaxVirtualAddress();
|
||||
uptr GetMaxUserVirtualAddress();
|
||||
// Threads
|
||||
tid_t GetTid();
|
||||
uptr GetThreadSelf();
|
||||
|
|
|
@ -186,7 +186,7 @@ uptr GetMmapGranularity() { return PAGE_SIZE; }
|
|||
|
||||
sanitizer_shadow_bounds_t ShadowBounds;
|
||||
|
||||
uptr GetMaxVirtualAddress() {
|
||||
uptr GetMaxUserVirtualAddress() {
|
||||
ShadowBounds = __sanitizer_shadow_bounds();
|
||||
return ShadowBounds.memory_limit - 1;
|
||||
}
|
||||
|
|
|
@ -952,7 +952,7 @@ static uptr GetKernelAreaSize() {
|
|||
}
|
||||
#endif // SANITIZER_WORDSIZE == 32
|
||||
|
||||
uptr GetMaxVirtualAddress() {
|
||||
uptr GetMaxUserVirtualAddress() {
|
||||
#if SANITIZER_NETBSD && defined(__x86_64__)
|
||||
return 0x7f7ffffff000ULL; // (0x00007f8000000000 - PAGE_SIZE)
|
||||
#elif SANITIZER_WORDSIZE == 64
|
||||
|
|
|
@ -849,7 +849,7 @@ uptr GetTaskInfoMaxAddress() {
|
|||
}
|
||||
#endif
|
||||
|
||||
uptr GetMaxVirtualAddress() {
|
||||
uptr GetMaxUserVirtualAddress() {
|
||||
#if SANITIZER_WORDSIZE == 64
|
||||
# if defined(__aarch64__) && SANITIZER_IOS && !SANITIZER_IOSSIM
|
||||
// Get the maximum VM address
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
namespace __sanitizer {
|
||||
|
||||
void RestrictMemoryToMaxAddress(uptr max_address) {
|
||||
uptr size_to_mmap = GetMaxVirtualAddress() + 1 - max_address;
|
||||
uptr size_to_mmap = GetMaxUserVirtualAddress() + 1 - max_address;
|
||||
void *res = MmapFixedNoAccess(max_address, size_to_mmap, "high gap");
|
||||
CHECK(res != MAP_FAILED);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ uptr GetMmapGranularity() {
|
|||
return si.dwAllocationGranularity;
|
||||
}
|
||||
|
||||
uptr GetMaxVirtualAddress() {
|
||||
uptr GetMaxUserVirtualAddress() {
|
||||
SYSTEM_INFO si;
|
||||
GetSystemInfo(&si);
|
||||
return (uptr)si.lpMaximumApplicationAddress;
|
||||
|
|
|
@ -231,7 +231,7 @@ static void my_pthread_introspection_hook(unsigned int event, pthread_t thread,
|
|||
|
||||
void InitializePlatformEarly() {
|
||||
#if defined(__aarch64__)
|
||||
uptr max_vm = GetMaxVirtualAddress() + 1;
|
||||
uptr max_vm = GetMaxUserVirtualAddress() + 1;
|
||||
if (max_vm != Mapping::kHiAppMemEnd) {
|
||||
Printf("ThreadSanitizer: unsupported vm address limit %p, expected %p.\n",
|
||||
max_vm, Mapping::kHiAppMemEnd);
|
||||
|
|
Loading…
Reference in New Issue