forked from OSchip/llvm-project
[sanitizer] rename MmapNoAccess to MmapFixedNoAccess; NFC
llvm-svn: 267253
This commit is contained in:
parent
58bc64432c
commit
99ed605799
|
@ -328,7 +328,7 @@ static void InitializeHighMemEnd() {
|
|||
static void ProtectGap(uptr addr, uptr size) {
|
||||
if (!flags()->protect_shadow_gap)
|
||||
return;
|
||||
void *res = MmapNoAccess(addr, size, "shadow gap");
|
||||
void *res = MmapFixedNoAccess(addr, size, "shadow gap");
|
||||
if (addr == (uptr)res)
|
||||
return;
|
||||
// A few pages at the start of the address space can not be protected.
|
||||
|
@ -339,7 +339,7 @@ static void ProtectGap(uptr addr, uptr size) {
|
|||
while (size > step && addr < kZeroBaseMaxShadowStart) {
|
||||
addr += step;
|
||||
size -= step;
|
||||
void *res = MmapNoAccess(addr, size, "shadow gap");
|
||||
void *res = MmapFixedNoAccess(addr, size, "shadow gap");
|
||||
if (addr == (uptr)res)
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -411,7 +411,7 @@ static void dfsan_init(int argc, char **argv, char **envp) {
|
|||
// case by disabling memory protection when ASLR is disabled.
|
||||
uptr init_addr = (uptr)&dfsan_init;
|
||||
if (!(init_addr >= UnusedAddr() && init_addr < AppAddr()))
|
||||
MmapNoAccess(UnusedAddr(), AppAddr() - UnusedAddr());
|
||||
MmapFixedNoAccess(UnusedAddr(), AppAddr() - UnusedAddr());
|
||||
|
||||
InitializeInterceptors();
|
||||
|
||||
|
|
|
@ -55,14 +55,14 @@ static bool CheckMemoryRangeAvailability(uptr beg, uptr size) {
|
|||
|
||||
static bool ProtectMemoryRange(uptr beg, uptr size, const char *name) {
|
||||
if (size > 0) {
|
||||
void *addr = MmapNoAccess(beg, size, name);
|
||||
void *addr = MmapFixedNoAccess(beg, size, name);
|
||||
if (beg == 0 && addr) {
|
||||
// Depending on the kernel configuration, we may not be able to protect
|
||||
// the page at address zero.
|
||||
uptr gap = 16 * GetPageSizeCached();
|
||||
beg += gap;
|
||||
size -= gap;
|
||||
addr = MmapNoAccess(beg, size, name);
|
||||
addr = MmapFixedNoAccess(beg, size, name);
|
||||
}
|
||||
if ((uptr)addr != beg) {
|
||||
uptr end = beg + size - 1;
|
||||
|
|
|
@ -324,11 +324,11 @@ class SizeClassAllocator64 {
|
|||
|
||||
void Init() {
|
||||
if (kUsingConstantSpaceBeg) {
|
||||
CHECK_EQ(kSpaceBeg,
|
||||
reinterpret_cast<uptr>(MmapNoAccess(kSpaceBeg, kSpaceSize)));
|
||||
CHECK_EQ(kSpaceBeg, reinterpret_cast<uptr>(
|
||||
MmapFixedNoAccess(kSpaceBeg, kSpaceSize)));
|
||||
} else {
|
||||
NonConstSpaceBeg = reinterpret_cast<uptr>(
|
||||
MmapNoAccess(0, kSpaceSize + AdditionalSize()));
|
||||
MmapFixedNoAccess(0, kSpaceSize + AdditionalSize()));
|
||||
CHECK_NE(NonConstSpaceBeg, ~(uptr)0);
|
||||
}
|
||||
MapWithCallback(SpaceEnd(), AdditionalSize());
|
||||
|
|
|
@ -84,10 +84,10 @@ void *MmapFixedNoReserve(uptr fixed_addr, uptr size,
|
|||
const char *name = nullptr);
|
||||
void *MmapNoReserveOrDie(uptr size, const char *mem_type);
|
||||
void *MmapFixedOrDie(uptr fixed_addr, uptr size);
|
||||
void *MmapNoAccess(uptr fixed_addr, uptr size, const char *name = nullptr);
|
||||
void *MmapFixedNoAccess(uptr fixed_addr, uptr size, const char *name = nullptr);
|
||||
// Map aligned chunk of address space; size and alignment are powers of two.
|
||||
void *MmapAlignedOrDie(uptr size, uptr alignment, const char *mem_type);
|
||||
// Disallow access to a memory range. Use MmapNoAccess to allocate an
|
||||
// Disallow access to a memory range. Use MmapFixedNoAccess to allocate an
|
||||
// unaccessible memory.
|
||||
bool MprotectNoAccess(uptr addr, uptr size);
|
||||
bool MprotectReadOnly(uptr addr, uptr size);
|
||||
|
|
|
@ -270,7 +270,7 @@ void *MmapFixedNoReserve(uptr fixed_addr, uptr size, const char *name) {
|
|||
return (void *)p;
|
||||
}
|
||||
|
||||
void *MmapNoAccess(uptr fixed_addr, uptr size, const char *name) {
|
||||
void *MmapFixedNoAccess(uptr fixed_addr, uptr size, const char *name) {
|
||||
int fd = name ? GetNamedMappingFd(name, size) : -1;
|
||||
unsigned flags = MAP_PRIVATE | MAP_FIXED | MAP_NORESERVE;
|
||||
if (fd == -1) flags |= MAP_ANON;
|
||||
|
|
|
@ -200,7 +200,7 @@ void *MmapNoReserveOrDie(uptr size, const char *mem_type) {
|
|||
return MmapOrDie(size, mem_type);
|
||||
}
|
||||
|
||||
void *MmapNoAccess(uptr fixed_addr, uptr size, const char *name) {
|
||||
void *MmapFixedNoAccess(uptr fixed_addr, uptr size, const char *name) {
|
||||
(void)name; // unsupported
|
||||
void *res = VirtualAlloc((LPVOID)fixed_addr, size,
|
||||
MEM_RESERVE | MEM_COMMIT, PAGE_NOACCESS);
|
||||
|
|
|
@ -105,7 +105,7 @@ static void ProtectRange(uptr beg, uptr end) {
|
|||
CHECK_LE(beg, end);
|
||||
if (beg == end)
|
||||
return;
|
||||
if (beg != (uptr)MmapNoAccess(beg, end - beg)) {
|
||||
if (beg != (uptr)MmapFixedNoAccess(beg, end - beg)) {
|
||||
Printf("FATAL: ThreadSanitizer can not protect [%zx,%zx]\n", beg, end);
|
||||
Printf("FATAL: Make sure you are not using unlimited stack\n");
|
||||
Die();
|
||||
|
|
Loading…
Reference in New Issue