From: Martin Mares Date: Sat, 28 Mar 2009 16:21:53 +0000 (+0100) Subject: Box: Use SIGSTOP to notify the parent that the child is ready to be traced X-Git-Tag: python-dummy-working~109 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=60df4f1d5b7aa59fdf47d87e8352e108b35ffca2;p=moe.git Box: Use SIGSTOP to notify the parent that the child is ready to be traced instead of SIGCHLD. This should be safer. --- diff --git a/box/box.c b/box/box.c index da7dfc1..f574f86 100644 --- a/box/box.c +++ b/box/box.c @@ -944,6 +944,11 @@ boxkeeper(void) msg("= %ld\n", u.regs.eax); ptrace(PTRACE_SYSCALL, box_pid, 0, 0); } + else if (sig == SIGSTOP) + { + msg(">> SIGSTOP\n"); + ptrace(PTRACE_SYSCALL, box_pid, 0, 0); + } else if (sig != SIGSTOP && sig != SIGXCPU && sig != SIGXFSZ) { msg(">> Signal %d\n", sig); @@ -1007,8 +1012,7 @@ box_inside(int argc, char **argv) if (ptrace(PTRACE_TRACEME) < 0) die("ptrace(PTRACE_TRACEME): %m"); /* Trick: Make sure that we are stopped until the boxkeeper wakes up. */ - signal(SIGCHLD, SIG_IGN); - raise(SIGCHLD); + raise(SIGSTOP); } execve(args[0], args, env); die("execve(\"%s\"): %m", args[0]);