cts: security: Generalize AslrTest

The AslrTest only the checks randomization of the stack memory, which is
fairly random even with ASLR disabled in the kernel. To improve the
test, also check the location of the shell binary, which does not change
much with ASLR disabled. The regular expression used to check the maps
file is further generalized to account for formatting differences
between kernels and devices.

Bug: 33351919
Test: Verified the test fails on kernels with ASLR disabled
Change-Id: Iebdb997e1066f80a19fd4fc3ee9cde9aa7c8e1af
diff --git a/tests/tests/security/src/android/security/cts/AslrTest.java b/tests/tests/security/src/android/security/cts/AslrTest.java
index 378aa0f..67bb48f 100644
--- a/tests/tests/security/src/android/security/cts/AslrTest.java
+++ b/tests/tests/security/src/android/security/cts/AslrTest.java
@@ -52,7 +52,7 @@
         BufferedReader reader = new BufferedReader(
                 new InputStreamReader(new FileInputStream(pfd.getFileDescriptor())));
 
-        Pattern p = Pattern.compile("^([a-f0-9]+)\\-.+\\[" + mappingName + "\\]$");
+        Pattern p = Pattern.compile("^([a-f0-9]+).*" + mappingName + ".*");
         String line;
 
         while ((line = reader.readLine()) != null) {
@@ -97,7 +97,8 @@
     }
 
     public void testRandomization() throws Exception {
-        testMappingEntropy("stack");
+        testMappingEntropy("\\[stack\\]");
+        testMappingEntropy("/system/bin/");
     }
 
     public void testOneExecutableIsPie() throws IOException {