(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:
Evgeniy Stepanov 2017-11-07 23:51:22 +00:00
parent 367ca01478
commit 0379d3f844
11 changed files with 11 additions and 11 deletions

View File

@ -28,7 +28,7 @@
namespace __asan { namespace __asan {
// The system already set up the shadow memory for us. // 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). // AsanInitInternal->InitializeHighMemEnd (asan_rtl.cc).
// Just do some additional sanity checks here. // Just do some additional sanity checks here.
void InitializeShadowMemory() { void InitializeShadowMemory() {

View File

@ -307,7 +307,7 @@ static void asan_atexit() {
static void InitializeHighMemEnd() { static void InitializeHighMemEnd() {
#if !ASAN_FIXED_MAPPING #if !ASAN_FIXED_MAPPING
kHighMemEnd = GetMaxVirtualAddress(); kHighMemEnd = GetMaxUserVirtualAddress();
// Increase kHighMemEnd to make sure it's properly // Increase kHighMemEnd to make sure it's properly
// aligned together with kHighMemBeg: // aligned together with kHighMemBeg:
kHighMemEnd |= SHADOW_GRANULARITY * GetMmapGranularity() - 1; kHighMemEnd |= SHADOW_GRANULARITY * GetMmapGranularity() - 1;

View File

@ -280,7 +280,7 @@ void InitShadow() {
CHECK_EQ(0, GetShadow()); CHECK_EQ(0, GetShadow());
CHECK_EQ(0, GetShadowSize()); CHECK_EQ(0, GetShadowSize());
uptr vma = GetMaxVirtualAddress(); uptr vma = GetMaxUserVirtualAddress();
// Shadow is 2 -> 2**kShadowGranularity. // Shadow is 2 -> 2**kShadowGranularity.
SetShadowSize((vma >> (kShadowGranularity - 1)) + 1); SetShadowSize((vma >> (kShadowGranularity - 1)) + 1);
VReport(1, "CFI: VMA size %zx, shadow size %zx\n", vma, GetShadowSize()); VReport(1, "CFI: VMA size %zx, shadow size %zx\n", vma, GetShadowSize());

View File

@ -120,7 +120,7 @@ bool InitShadow(bool init_origins) {
return false; return false;
} }
const uptr maxVirtualAddress = GetMaxVirtualAddress(); const uptr maxVirtualAddress = GetMaxUserVirtualAddress();
for (unsigned i = 0; i < kMemoryLayoutSize; ++i) { for (unsigned i = 0; i < kMemoryLayoutSize; ++i) {
uptr start = kMemoryLayout[i].start; uptr start = kMemoryLayout[i].start;

View File

@ -73,7 +73,7 @@ INLINE uptr GetPageSizeCached() {
return PageSizeCached; return PageSizeCached;
} }
uptr GetMmapGranularity(); uptr GetMmapGranularity();
uptr GetMaxVirtualAddress(); uptr GetMaxUserVirtualAddress();
// Threads // Threads
tid_t GetTid(); tid_t GetTid();
uptr GetThreadSelf(); uptr GetThreadSelf();

View File

@ -186,7 +186,7 @@ uptr GetMmapGranularity() { return PAGE_SIZE; }
sanitizer_shadow_bounds_t ShadowBounds; sanitizer_shadow_bounds_t ShadowBounds;
uptr GetMaxVirtualAddress() { uptr GetMaxUserVirtualAddress() {
ShadowBounds = __sanitizer_shadow_bounds(); ShadowBounds = __sanitizer_shadow_bounds();
return ShadowBounds.memory_limit - 1; return ShadowBounds.memory_limit - 1;
} }

View File

@ -952,7 +952,7 @@ static uptr GetKernelAreaSize() {
} }
#endif // SANITIZER_WORDSIZE == 32 #endif // SANITIZER_WORDSIZE == 32
uptr GetMaxVirtualAddress() { uptr GetMaxUserVirtualAddress() {
#if SANITIZER_NETBSD && defined(__x86_64__) #if SANITIZER_NETBSD && defined(__x86_64__)
return 0x7f7ffffff000ULL; // (0x00007f8000000000 - PAGE_SIZE) return 0x7f7ffffff000ULL; // (0x00007f8000000000 - PAGE_SIZE)
#elif SANITIZER_WORDSIZE == 64 #elif SANITIZER_WORDSIZE == 64

View File

@ -849,7 +849,7 @@ uptr GetTaskInfoMaxAddress() {
} }
#endif #endif
uptr GetMaxVirtualAddress() { uptr GetMaxUserVirtualAddress() {
#if SANITIZER_WORDSIZE == 64 #if SANITIZER_WORDSIZE == 64
# if defined(__aarch64__) && SANITIZER_IOS && !SANITIZER_IOSSIM # if defined(__aarch64__) && SANITIZER_IOS && !SANITIZER_IOSSIM
// Get the maximum VM address // Get the maximum VM address

View File

@ -20,7 +20,7 @@
namespace __sanitizer { namespace __sanitizer {
void RestrictMemoryToMaxAddress(uptr max_address) { 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"); void *res = MmapFixedNoAccess(max_address, size_to_mmap, "high gap");
CHECK(res != MAP_FAILED); CHECK(res != MAP_FAILED);
} }

View File

@ -64,7 +64,7 @@ uptr GetMmapGranularity() {
return si.dwAllocationGranularity; return si.dwAllocationGranularity;
} }
uptr GetMaxVirtualAddress() { uptr GetMaxUserVirtualAddress() {
SYSTEM_INFO si; SYSTEM_INFO si;
GetSystemInfo(&si); GetSystemInfo(&si);
return (uptr)si.lpMaximumApplicationAddress; return (uptr)si.lpMaximumApplicationAddress;

View File

@ -231,7 +231,7 @@ static void my_pthread_introspection_hook(unsigned int event, pthread_t thread,
void InitializePlatformEarly() { void InitializePlatformEarly() {
#if defined(__aarch64__) #if defined(__aarch64__)
uptr max_vm = GetMaxVirtualAddress() + 1; uptr max_vm = GetMaxUserVirtualAddress() + 1;
if (max_vm != Mapping::kHiAppMemEnd) { if (max_vm != Mapping::kHiAppMemEnd) {
Printf("ThreadSanitizer: unsupported vm address limit %p, expected %p.\n", Printf("ThreadSanitizer: unsupported vm address limit %p, expected %p.\n",
max_vm, Mapping::kHiAppMemEnd); max_vm, Mapping::kHiAppMemEnd);