summaryrefslogtreecommitdiff
path: root/debuggerd/handler/debuggerd_handler.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2019-04-16 13:17:08 -0700
committerJosh Gao <jmgao@google.com>2019-04-17 17:53:43 -0700
commit6b8caf8eb709cc8eec1691d44ce09db4559e165d (patch)
treec528d1d67fca3180ad19b488db0e0165771322b9 /debuggerd/handler/debuggerd_handler.cpp
parent08ccc735a386bdfb410538c714ec7871fda21537 (diff)
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 (cherry picked from commit 18cb6812474e00050efab19e242c8a04ed470bec)
Diffstat (limited to 'debuggerd/handler/debuggerd_handler.cpp')
-rw-r--r--debuggerd/handler/debuggerd_handler.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp
index bca5e36d5..598ea85e8 100644
--- a/debuggerd/handler/debuggerd_handler.cpp
+++ b/debuggerd/handler/debuggerd_handler.cpp
@@ -268,8 +268,15 @@ static void create_vm_process() {
_exit(errno);
}
- // Exit immediately on both sides of the fork.
- // crash_dump is ptracing us, so it'll get to do whatever it wants in between.
+ // crash_dump is ptracing both sides of the fork; it'll let the parent exit,
+ // 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);
}