summaryrefslogtreecommitdiffstats
path: root/runtime/mem_map.h
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-05-19 17:01:13 -0700
committerAndreas Gampe <agampe@google.com>2014-05-20 11:18:01 -0700
commitd8f26dbebe72c1cbdfa85bdeeb003283c7435db3 (patch)
treed752729ef80ed46877681874ac69b3e846f34078 /runtime/mem_map.h
parentfd1264475562006c93b651d33e0a6266e8093ebe (diff)
downloadandroid_art-d8f26dbebe72c1cbdfa85bdeeb003283c7435db3.tar.gz
android_art-d8f26dbebe72c1cbdfa85bdeeb003283c7435db3.tar.bz2
android_art-d8f26dbebe72c1cbdfa85bdeeb003283c7435db3.zip
ART: Randomize mem_map start address for linear scan search
When using linear scan for mem_map, randomize the start of the search with getauxval(AT_RANDOM). Change-Id: Id1e4c86b928147d74b9b0b73ff704de5d87b4500
Diffstat (limited to 'runtime/mem_map.h')
-rw-r--r--runtime/mem_map.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/mem_map.h b/runtime/mem_map.h
index 4255d17f27..141185663b 100644
--- a/runtime/mem_map.h
+++ b/runtime/mem_map.h
@@ -28,6 +28,12 @@
namespace art {
// Used to keep track of mmap segments.
+//
+// On 64b systems not supporting MAP_32BIT, the implementation of MemMap will do a linear scan
+// for free pages. For security, the start of this scan should be randomized. This requires a
+// dynamic initializer.
+// For this to work, it is paramount that there are no other static initializers that access MemMap.
+// Otherwise, calls might see uninitialized values.
class MemMap {
public:
// Request an anonymous region of length 'byte_count' and a requested base address.