Allow zygote to execve

Allow zygote to execute other programs (such as dex2oat).
This fixes the bug that cause ART framework boot images failed to load
and result to extremely serious performance degradation.

Fix #1195
This commit is contained in:
topjohnwu 2019-03-09 22:58:05 -05:00
parent faf4d76388
commit 4581354e7a

View File

@ -424,11 +424,13 @@ void proc_monitor() {
if (attaches[pid] && check_pid(pid))
continue;
break;
case PTRACE_EVENT_EXEC:
case PTRACE_EVENT_EXIT:
PTRACE_LOG("exited with status: [%d]\n", msg);
PTRACE_LOG("exited or execve\n", msg);
attaches[pid] = false;
unknowns[pid] = false;
break;
xptrace(PTRACE_DETACH, pid);
continue;
default:
PTRACE_LOG("unknown event: %d\n", WEVENT(status));
break;
@ -438,7 +440,8 @@ void proc_monitor() {
} else if (WSTOPSIG(status) == SIGSTOP) {
if (attaches[pid]) {
PTRACE_LOG("SIGSTOP from zygote child\n");
xptrace(PTRACE_SETOPTIONS, pid, nullptr, PTRACE_O_TRACECLONE | PTRACE_O_TRACEEXIT);
xptrace(PTRACE_SETOPTIONS, pid, nullptr,
PTRACE_O_TRACECLONE | PTRACE_O_TRACEEXEC | PTRACE_O_TRACEEXIT);
} else {
PTRACE_LOG("SIGSTOP from unknown\n");
unknowns[pid] = true;