diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2016-12-05 15:50:47 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2016-12-05 21:07:26 +0100 |
| commit | 66700b2c86dbef43c2b14800f84caa06eb9d2864 (patch) | |
| tree | 4b6baa5aa9622a275a565ee3f93542e3505df9e4 /executor/common.h | |
| parent | ce1cd11efcd29052fda2f9e6d670c286e9c5021e (diff) | |
executor: change the way we wait for children
waitpid(pid) does not work if child invokes ptrace(PTRACE_TRACEME):
https://groups.google.com/forum/#!topic/syzkaller/SjWzOnNRRIU
Use waitpid(-1) instead.
Diffstat (limited to 'executor/common.h')
| -rw-r--r-- | executor/common.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/executor/common.h b/executor/common.h index 19da79b5e..472db554c 100644 --- a/executor/common.h +++ b/executor/common.h @@ -658,7 +658,7 @@ void loop() int status = 0; uint64_t start = current_time_ms(); for (;;) { - int res = waitpid(pid, &status, __WALL | WNOHANG); + int res = waitpid(-1, &status, __WALL | WNOHANG); int errno0 = errno; if (res == pid) break; @@ -666,7 +666,8 @@ void loop() if (current_time_ms() - start > 5 * 1000) { kill(-pid, SIGKILL); kill(pid, SIGKILL); - waitpid(pid, &status, __WALL); + while (waitpid(-1, &status, __WALL) != pid) { + } break; } } |
