mirror of
https://github.com/google/nsjail.git
synced 2026-08-30 18:41:30 -07:00
subproc: verify that a pid in a pid map doesn't exist before inserting
This commit is contained in:
@@ -215,6 +215,9 @@ static void addProc(nsjconf_t* nsjconf, pid_t pid, int sock) {
|
||||
snprintf(fname, sizeof(fname), "/proc/%d/syscall", (int)pid);
|
||||
p.pid_syscall_fd = TEMP_FAILURE_RETRY(open(fname, O_RDONLY | O_CLOEXEC));
|
||||
|
||||
if (nsjconf->pids.find(pid) != nsjconf->pids.end()) {
|
||||
LOG_F("pid=%d already exists", pid);
|
||||
}
|
||||
nsjconf->pids.insert(std::make_pair(pid, p));
|
||||
|
||||
LOG_D("Added pid=%d with start time '%u' to the queue for IP: '%s'", pid,
|
||||
|
||||
Reference in New Issue
Block a user