Remove information about in-progress syscalls on process exit.

PiperOrigin-RevId: 463091104
Change-Id: I402cb61e9e816a20a87274ea874cddf91c101e14
This commit is contained in:
Sandboxed API Team 2022-07-25 08:27:27 -07:00 committed by Copybara-Service
parent 4d906e7143
commit 78ee270388

View File

@ -816,8 +816,7 @@ void Monitor::ActionProcessSyscall(Regs* regs, const Syscall& syscall) {
if (trace_response == Notify::TraceAction::kInspectAfterReturn) {
// Note that a process might die without an exit-stop before the syscall is
// completed (eg. a thread calls execve() and the thread group leader dies),
// so this entry might never get removed from the table. This may increase
// the monitor's memory usage by O(number-of-sandboxed-pids).
// so the entry is removed when the process exits.
syscalls_in_progress_[regs->pid()] = syscall;
CompleteSyscall(regs->pid(), 0);
return;
@ -985,6 +984,9 @@ void Monitor::EventPtraceExec(pid_t pid, int event_msg) {
}
void Monitor::EventPtraceExit(pid_t pid, int event_msg) {
// Forget about any syscalls in progress for this PID.
syscalls_in_progress_.erase(pid);
// A regular exit, let it continue (fast-path).
if (ABSL_PREDICT_TRUE(
WIFEXITED(event_msg) &&