diff options
author | Dmitriy Ivanov <dimitry@google.com> | 2014-05-14 01:45:50 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-05-14 01:45:50 +0000 |
commit | c6b5834ceb3df72608a8fe3526a2db337e504512 (patch) | |
tree | 6ecb0186e57aa0ed8cdcef28194f84c4bea2c62d /linker/linker_allocator.cpp | |
parent | 3557f2f61b9cc736d245aff1e979500cc399e491 (diff) | |
parent | bc23e530c4db5175a065eeef36553c9c2c78fcf4 (diff) | |
download | android_bionic-c6b5834ceb3df72608a8fe3526a2db337e504512.tar.gz android_bionic-c6b5834ceb3df72608a8fe3526a2db337e504512.tar.bz2 android_bionic-c6b5834ceb3df72608a8fe3526a2db337e504512.zip |
Merge "Remove page level mprotects"
Diffstat (limited to 'linker/linker_allocator.cpp')
-rw-r--r-- | linker/linker_allocator.cpp | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/linker/linker_allocator.cpp b/linker/linker_allocator.cpp index 805844fc2..60ce1ea47 100644 --- a/linker/linker_allocator.cpp +++ b/linker/linker_allocator.cpp @@ -42,8 +42,6 @@ void LinkerBlockAllocator::init(size_t block_size) { void* LinkerBlockAllocator::alloc() { if (free_block_list_ == nullptr) { create_new_page(); - } else { - protect_page(free_block_list_, PROT_READ | PROT_WRITE); } FreeBlockInfo* block_info = reinterpret_cast<FreeBlockInfo*>(free_block_list_); @@ -82,10 +80,8 @@ void LinkerBlockAllocator::free(void* block) { FreeBlockInfo* block_info = reinterpret_cast<FreeBlockInfo*>(block); - protect_page(block_info, PROT_READ | PROT_WRITE); block_info->next_block = free_block_list_; block_info->num_free_blocks = 1; - protect_page(block_info, PROT_READ); free_block_list_ = block_info; } @@ -98,14 +94,6 @@ void LinkerBlockAllocator::protect_all(int prot) { } } -void LinkerBlockAllocator::protect_page(void* block, int prot) { - LinkerAllocatorPage* page = find_page(block); - if (page == nullptr || mprotect(page, PAGE_SIZE, prot) == -1) { - abort(); - } -} - - void LinkerBlockAllocator::create_new_page() { LinkerAllocatorPage* page = reinterpret_cast<LinkerAllocatorPage*>(mmap(nullptr, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0)); |