OSDN Git Service

Zygote: don't inhibit randomization on non-arm platforms
authorNick Kralevich <nnk@google.com>
Fri, 19 Oct 2012 19:15:52 +0000 (12:15 -0700)
committerNick Kralevich <nnk@google.com>
Fri, 19 Oct 2012 19:15:52 +0000 (12:15 -0700)
Change-Id: I5fd4887612cb0c38f9736c3289056e99970a8ae4

vm/native/dalvik_system_Zygote.cpp

index e73f1fe..cb8172f 100644 (file)
@@ -481,6 +481,7 @@ static int setSELinuxContext(uid_t uid, bool isSystemServer,
 #endif
 }
 
+#ifdef __arm__
 static bool needsNoRandomizeWorkaround() {
     int major;
     int minor;
@@ -496,6 +497,7 @@ static bool needsNoRandomizeWorkaround() {
     // Kernels before 3.4.* need the workaround.
     return (major < 3) || ((major == 3) && (minor < 4));
 }
+#endif
 
 /*
  * Utility routine to fork zygote and specialize the child process.
@@ -623,6 +625,7 @@ static pid_t forkAndSpecializeCommon(const u4* args, bool isSystemServer)
             dvmAbort();
         }
 
+#ifdef __arm__
         if (needsNoRandomizeWorkaround()) {
             int current = personality(0xffffFFFF);
             int success = personality((ADDR_NO_RANDOMIZE | current));
@@ -630,6 +633,7 @@ static pid_t forkAndSpecializeCommon(const u4* args, bool isSystemServer)
                 ALOGW("Personality switch failed. current=%d error=%d\n", current, errno);
             }
         }
+#endif
 
         err = setCapabilities(permittedCapabilities, effectiveCapabilities);
         if (err != 0) {