Use arc4random_buf instead of getauxval(AT_RANDOM).

Reclaim the AT_RANDOM bytes used by ART for bionic.

Bug: http://b/23942752
Change-Id: Iceddce7f08fa887a7bb6828d75ef21426c413863
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc
index d9ad7dc..2a019c5 100644
--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -19,15 +19,11 @@
 #include "base/memory_tool.h"
 #include <backtrace/BacktraceMap.h>
 #include <inttypes.h>
+#include <stdlib.h>
 
 #include <memory>
 #include <sstream>
 
-// See CreateStartPos below.
-#ifdef __BIONIC__
-#include <sys/auxv.h>
-#endif
-
 #include "base/stringprintf.h"
 
 #pragma GCC diagnostic push
@@ -103,7 +99,7 @@
 // --------------------------------------
 // start
 //
-// getauxval as an entropy source is exposed in Bionic, but not in glibc before 2.16. When we
+// arc4random as an entropy source is exposed in Bionic, but not in glibc. When we
 // do not have Bionic, simply start with LOW_MEM_START.
 
 // Function is standalone so it can be tested somewhat in mem_map_test.cc.
@@ -125,11 +121,11 @@
 
 static uintptr_t GenerateNextMemPos() {
 #ifdef __BIONIC__
-  uint8_t* random_data = reinterpret_cast<uint8_t*>(getauxval(AT_RANDOM));
-  // The lower 8B are taken for the stack guard. Use the upper 8B (with mask).
-  return CreateStartPos(*reinterpret_cast<uintptr_t*>(random_data + 8));
+  uint64_t random_data;
+  arc4random_buf(&random_data, sizeof(random_data));
+  return CreateStartPos(random_data);
 #else
-  // No auxv on host, see above.
+  // No arc4random on host, see above.
   return LOW_MEM_START;
 #endif
 }