Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Snippets Groups Projects
Commit 18cb6812 authored by Josh Gao's avatar Josh Gao
Browse files

debuggerd: call setsid in our children.

There appears to be a kernel bug that causes SIGHUP and SIGCONT to be
sent to the parent process group we spawn from if the process group
contains stopped jobs (e.g. the parent itself, because of wait_for_gdb).

Call setsid in all of our children to prevent this from happening.

Bug: http://b/31124563
Test: adb shell 'setprop debug.debuggerd.wait_for_gdb 1; killall -ABRT surfaceflinger'
Change-Id: I1a48d70886880a5bfbe2deb80d48deece55faf09
parent a853a2f8
Branches
No related tags found
No related merge requests found
...@@ -363,6 +363,12 @@ int main(int argc, char** argv) { ...@@ -363,6 +363,12 @@ int main(int argc, char** argv) {
DefuseSignalHandlers(); DefuseSignalHandlers();
InstallSigPipeHandler(); InstallSigPipeHandler();
// There appears to be a bug in the kernel where our death causes SIGHUP to
// be sent to our process group if we exit while it has stopped jobs (e.g.
// because of wait_for_gdb). Use setsid to create a new process group to
// avoid hitting this.
setsid();
atrace_begin(ATRACE_TAG, "before reparent"); atrace_begin(ATRACE_TAG, "before reparent");
pid_t target_process = getppid(); pid_t target_process = getppid();
......
...@@ -268,8 +268,15 @@ static void create_vm_process() { ...@@ -268,8 +268,15 @@ static void create_vm_process() {
_exit(errno); _exit(errno);
} }
// Exit immediately on both sides of the fork. // crash_dump is ptracing both sides of the fork; it'll let the parent exit,
// crash_dump is ptracing us, so it'll get to do whatever it wants in between. // but keep the orphan stopped to peek at its memory.
// There appears to be a bug in the kernel where our death causes SIGHUP to
// be sent to our process group if we exit while it has stopped jobs (e.g.
// because of wait_for_gdb). Use setsid to create a new process group to
// avoid hitting this.
setsid();
_exit(0); _exit(0);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment