summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Wilson <cdwilson@google.com> 2022-06-17 23:57:52 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-06-17 23:57:52 +0000
commit4ea19f97a3d44862be35457ff41abcace877c7c5 (patch)
tree3f7a6123760855006d3300f15e9d143b89c5c7c8
parent0052b09bb965a5030dee0dce5c3abd30afac62e3 (diff)
parentd517b25c2d416341b74584e2059c243a446004cd (diff)
Merge "Revert "Reset stack guard after fork from Zygote"" am: 36ea7d5a37 am: 4f37f950e6 am: d517b25c2d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2130633 Change-Id: I9dff524a3b4767070de33e7beac986a85f62dda2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--core/jni/com_android_internal_os_Zygote.cpp15
-rw-r--r--core/jni/com_android_internal_os_Zygote.h8
-rw-r--r--core/jni/com_android_internal_os_ZygoteCommandBuffer.cpp1
3 files changed, 0 insertions, 24 deletions
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 5cb0de324106..34fd478baeda 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -94,10 +94,6 @@
#include "nativebridge/native_bridge.h"
-#if defined(__BIONIC__)
-extern "C" void android_reset_stack_guards();
-#endif
-
namespace {
// TODO (chriswailes): Add a function to initialize native Zygote data.
@@ -416,7 +412,6 @@ static void sendSigChildStatus(const pid_t pid, const uid_t uid, const int statu
}
// This signal handler is for zygote mode, since the zygote must reap its children
-NO_STACK_PROTECTOR
static void SigChldHandler(int /*signal_number*/, siginfo_t* info, void* /*ucontext*/) {
pid_t pid;
int status;
@@ -2047,7 +2042,6 @@ static std::set<int>* gPreloadFds = nullptr;
static bool gPreloadFdsExtracted = false;
// Utility routine to fork a process from the zygote.
-NO_STACK_PROTECTOR
pid_t zygote::ForkCommon(JNIEnv* env, bool is_system_server,
const std::vector<int>& fds_to_close,
const std::vector<int>& fds_to_ignore,
@@ -2104,11 +2098,6 @@ pid_t zygote::ForkCommon(JNIEnv* env, bool is_system_server,
setpriority(PRIO_PROCESS, 0, PROCESS_PRIORITY_MIN);
}
-#if defined(__BIONIC__)
- // Reset the stack guard for the new process.
- android_reset_stack_guards();
-#endif
-
// The child process.
PreApplicationInit();
@@ -2141,7 +2130,6 @@ static void com_android_internal_os_Zygote_nativePreApplicationInit(JNIEnv*, jcl
PreApplicationInit();
}
-NO_STACK_PROTECTOR
static jint com_android_internal_os_Zygote_nativeForkAndSpecialize(
JNIEnv* env, jclass, jint uid, jint gid, jintArray gids, jint runtime_flags,
jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name,
@@ -2196,7 +2184,6 @@ static jint com_android_internal_os_Zygote_nativeForkAndSpecialize(
return pid;
}
-NO_STACK_PROTECTOR
static jint com_android_internal_os_Zygote_nativeForkSystemServer(
JNIEnv* env, jclass, uid_t uid, gid_t gid, jintArray gids,
jint runtime_flags, jobjectArray rlimits, jlong permitted_capabilities,
@@ -2268,7 +2255,6 @@ static jint com_android_internal_os_Zygote_nativeForkSystemServer(
* @param is_priority_fork Controls the nice level assigned to the newly created process
* @return child pid in the parent, 0 in the child
*/
-NO_STACK_PROTECTOR
static jint com_android_internal_os_Zygote_nativeForkApp(JNIEnv* env,
jclass,
jint read_pipe_fd,
@@ -2283,7 +2269,6 @@ static jint com_android_internal_os_Zygote_nativeForkApp(JNIEnv* env,
args_known == JNI_TRUE, is_priority_fork == JNI_TRUE, true);
}
-NO_STACK_PROTECTOR
int zygote::forkApp(JNIEnv* env,
int read_pipe_fd,
int write_pipe_fd,
diff --git a/core/jni/com_android_internal_os_Zygote.h b/core/jni/com_android_internal_os_Zygote.h
index 15f53e0814e3..b87396cbd5f5 100644
--- a/core/jni/com_android_internal_os_Zygote.h
+++ b/core/jni/com_android_internal_os_Zygote.h
@@ -20,14 +20,6 @@
#define LOG_TAG "Zygote"
#define ATRACE_TAG ATRACE_TAG_DALVIK
-/*
- * All functions that lead to ForkCommon must be marked with the
- * no_stack_protector attributed. Because ForkCommon changes the stack
- * protector cookie, all of the guard checks on the frames above ForkCommon
- * would fail when they are popped.
- */
-#define NO_STACK_PROTECTOR __attribute__((no_stack_protector))
-
#include <jni.h>
#include <vector>
#include <android-base/stringprintf.h>
diff --git a/core/jni/com_android_internal_os_ZygoteCommandBuffer.cpp b/core/jni/com_android_internal_os_ZygoteCommandBuffer.cpp
index 2b5b8f7a108e..add645dee718 100644
--- a/core/jni/com_android_internal_os_ZygoteCommandBuffer.cpp
+++ b/core/jni/com_android_internal_os_ZygoteCommandBuffer.cpp
@@ -377,7 +377,6 @@ void com_android_internal_os_ZygoteCommandBuffer_nativeReadFullyAndReset(JNIEnv*
// We only process fork commands if the peer uid matches expected_uid.
// For every fork command after the first, we check that the requested uid is at
// least minUid.
-NO_STACK_PROTECTOR
jboolean com_android_internal_os_ZygoteCommandBuffer_nativeForkRepeatedly(
JNIEnv* env,
jclass,