summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2017-06-09 15:27:15 -0700
committer Andreas Gampe <agampe@google.com> 2017-06-14 14:44:53 -0700
commite4deaf3ccdfaf33f0b4526e9963612bfa2dc79e8 (patch)
tree6af8ed52f680e3f65ffed43d52353c34803b668a
parent651ba599961ff0cdc36e83d3d58b1744d37ee9f7 (diff)
ART: JIT code cache allocation cleanup
Request the data cache with kProtData instead of kProtAll. It isn't necessary nor intended to be executable. The tail remap for the code cache will make all required parts executable, if possible. Also use a unique_ptr to plug a leak on failure. Bug: 36138508 Test: m Test: m test-art-host Test: Test SANITIZE_LITE=true build with wrap.system_server = asanwrapper Change-Id: Id9e2e51bc8d7a29db99c406cd1e9ef6bbb8d444c
-rw-r--r--runtime/jit/jit_code_cache.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index cd386c06fa..3997c69879 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -90,17 +90,17 @@ JitCodeCache* JitCodeCache::Create(size_t initial_capacity,
// We could do PC-relative addressing to avoid this problem, but that
// would require reserving code and data area before submitting, which
// means more windows for the code memory to be RWX.
- MemMap* data_map = MemMap::MapAnonymous(
+ std::unique_ptr<MemMap> data_map(MemMap::MapAnonymous(
"data-code-cache", nullptr,
max_capacity,
- kProtAll,
+ kProtData,
/* low_4gb */ true,
/* reuse */ false,
&error_str,
- use_ashmem);
+ use_ashmem));
if (data_map == nullptr) {
std::ostringstream oss;
- oss << "Failed to create read write execute cache: " << error_str << " size=" << max_capacity;
+ oss << "Failed to create read write cache: " << error_str << " size=" << max_capacity;
*error_msg = oss.str();
return nullptr;
}
@@ -129,7 +129,7 @@ JitCodeCache* JitCodeCache::Create(size_t initial_capacity,
code_size = initial_capacity - data_size;
DCHECK_EQ(code_size + data_size, initial_capacity);
return new JitCodeCache(
- code_map, data_map, code_size, data_size, max_capacity, garbage_collect_code);
+ code_map, data_map.release(), code_size, data_size, max_capacity, garbage_collect_code);
}
JitCodeCache::JitCodeCache(MemMap* code_map,