Revert logging after pre specialize

This commit is contained in:
topjohnwu 2021-11-16 03:12:01 -08:00
parent 50515d9128
commit 4b5651bd6f

View File

@ -167,10 +167,6 @@ DCL_HOOK_FUNC(int, unshare, int flags) {
// A place to clean things up before zygote evaluates fd table // A place to clean things up before zygote evaluates fd table
DCL_HOOK_FUNC(void, android_log_close) { DCL_HOOK_FUNC(void, android_log_close) {
HookContext::close_fds(); HookContext::close_fds();
if (g_ctx && g_ctx->pid <= 0) {
// In child process, no longer be able to access to magiskd
android_logging();
}
old_android_log_close(); old_android_log_close();
} }
@ -434,6 +430,9 @@ void HookContext::nativeSpecializeAppProcess_pre() {
} else { } else {
run_modules_pre(module_fds); run_modules_pre(module_fds);
} }
close_fds();
android_logging();
} }
void HookContext::nativeSpecializeAppProcess_post() { void HookContext::nativeSpecializeAppProcess_post() {
@ -461,12 +460,12 @@ void HookContext::nativeForkSystemServer_pre() {
ZLOGV("pre forkSystemServer\n"); ZLOGV("pre forkSystemServer\n");
run_modules_pre(remote_get_info(1000, "system_server", &info)); run_modules_pre(remote_get_info(1000, "system_server", &info));
close_fds(); close_fds();
android_logging();
} }
} }
void HookContext::nativeForkSystemServer_post() { void HookContext::nativeForkSystemServer_post() {
if (pid == 0) { if (pid == 0) {
android_logging();
ZLOGV("post forkSystemServer\n"); ZLOGV("post forkSystemServer\n");
run_modules_post(); run_modules_post();
} }
@ -478,13 +477,11 @@ void HookContext::nativeForkAndSpecialize_pre() {
flags[FORK_AND_SPECIALIZE] = true; flags[FORK_AND_SPECIALIZE] = true;
if (pid == 0) { if (pid == 0) {
nativeSpecializeAppProcess_pre(); nativeSpecializeAppProcess_pre();
close_fds();
} }
} }
void HookContext::nativeForkAndSpecialize_post() { void HookContext::nativeForkAndSpecialize_post() {
if (pid == 0) { if (pid == 0) {
android_logging();
nativeSpecializeAppProcess_post(); nativeSpecializeAppProcess_post();
} }
fork_post(); fork_post();