mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Do not emit an error on ESRCH in PTRACE_CONT
Process might be killed between waitpid and PTRACE_CONT, even though a PTRACE_EVENT_EXIT will be gererated, continuing will fail with ESRCH in that case. PiperOrigin-RevId: 249245726 Change-Id: Ib673529229a306d2266fa60caa3039b6bcd80a65
This commit is contained in:
parent
15993a34e2
commit
71a317e65f
|
@ -92,15 +92,25 @@ void InterruptProcess(pid_t pid) {
|
|||
|
||||
void ContinueProcess(pid_t pid, int signo) {
|
||||
if (ptrace(PTRACE_CONT, pid, 0, signo) == -1) {
|
||||
PLOG(ERROR) << "ptrace(PTRACE_CONT, pid=" << pid << ", sig=" << signo
|
||||
<< ")";
|
||||
if (errno == ESRCH) {
|
||||
LOG(WARNING) << "Process " << pid
|
||||
<< " died while trying to PTRACE_CONT it";
|
||||
} else {
|
||||
PLOG(ERROR) << "ptrace(PTRACE_CONT, pid=" << pid << ", sig=" << signo
|
||||
<< ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StopProcess(pid_t pid, int signo) {
|
||||
if (ptrace(PTRACE_LISTEN, pid, 0, signo) == -1) {
|
||||
PLOG(ERROR) << "ptrace(PTRACE_LISTEN, pid=" << pid << ", sig=" << signo
|
||||
<< ")";
|
||||
if (errno == ESRCH) {
|
||||
LOG(WARNING) << "Process " << pid
|
||||
<< " died while trying to PTRACE_LISTEN it";
|
||||
} else {
|
||||
PLOG(ERROR) << "ptrace(PTRACE_CONT, pid=" << pid << ", sig=" << signo
|
||||
<< ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user