Merge "Remove unnecessary ASLR workaround" am: 93f5f96418 am: cd21536cd4 am: 9bbdf18d5d am: 1ed76117cf am: 6c38504c15
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1811856
Change-Id: I9075d728788b9e9d7a74945e5f80769bb88fab4c
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index bed0aae..ce44e07 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -62,7 +62,6 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/un.h>
-#include <sys/utsname.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -850,26 +849,6 @@
}
}
-static bool NeedsNoRandomizeWorkaround() {
-#if !defined(__arm__)
- return false;
-#else
- int major;
- int minor;
- struct utsname uts;
- if (uname(&uts) == -1) {
- return false;
- }
-
- if (sscanf(uts.release, "%d.%d", &major, &minor) != 2) {
- return false;
- }
-
- // Kernels before 3.4.* need the workaround.
- return (major < 3) || ((major == 3) && (minor < 4));
-#endif
-}
-
// Utility to close down the Zygote socket file descriptors while
// the child is still running as root with Zygote's privileges. Each
// descriptor (if any) is closed via dup3(), replacing it with a valid
@@ -1740,15 +1719,6 @@
// runtime.
runtime_flags &= ~RuntimeFlags::GWP_ASAN_LEVEL_MASK;
- if (NeedsNoRandomizeWorkaround()) {
- // Work around ARM kernel ASLR lossage (http://b/5817320).
- int old_personality = personality(0xffffffff);
- int new_personality = personality(old_personality | ADDR_NO_RANDOMIZE);
- if (new_personality == -1) {
- ALOGW("personality(%d) failed: %s", new_personality, strerror(errno));
- }
- }
-
SetCapabilities(permitted_capabilities, effective_capabilities, permitted_capabilities,
fail_fn);