summaryrefslogtreecommitdiff
path: root/sandbox-systrace.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2020-01-23 07:10:22 +0000
committerDarren Tucker <dtucker@dtucker.net>2020-01-23 18:51:25 +1100
commit3bf2a6ac791d64046a537335a0f1d5e43579c5ad (patch)
tree76fcc0f1be306541c074be4aed3aca66023f0962 /sandbox-systrace.c
parente027c044c796f3a01081a91bee55741204283f28 (diff)
downloadopenssh-git-3bf2a6ac791d64046a537335a0f1d5e43579c5ad.tar.gz
upstream: Replace all calls to signal(2) with a wrapper around
sigaction(2). This wrapper blocks all other signals during the handler preventing races between handlers, and sets SA_RESTART which should reduce the potential for short read/write operations. OpenBSD-Commit-ID: 5e047663fd77a40d7b07bdabe68529df51fd2519
Diffstat (limited to 'sandbox-systrace.c')
-rw-r--r--sandbox-systrace.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sandbox-systrace.c b/sandbox-systrace.c
index 93e63b8e..e61d581a 100644
--- a/sandbox-systrace.c
+++ b/sandbox-systrace.c
@@ -105,7 +105,7 @@ ssh_sandbox_init(struct monitor *monitor)
box = xcalloc(1, sizeof(*box));
box->systrace_fd = -1;
box->child_pid = 0;
- box->osigchld = signal(SIGCHLD, SIG_IGN);
+ box->osigchld = ssh_signal(SIGCHLD, SIG_IGN);
return box;
}
@@ -114,7 +114,7 @@ void
ssh_sandbox_child(struct ssh_sandbox *box)
{
debug3("%s: ready", __func__);
- signal(SIGCHLD, box->osigchld);
+ ssh_signal(SIGCHLD, box->osigchld);
if (kill(getpid(), SIGSTOP) != 0)
fatal("%s: kill(%d, SIGSTOP)", __func__, getpid());
debug3("%s: started", __func__);
@@ -133,7 +133,7 @@ ssh_sandbox_parent(struct ssh_sandbox *box, pid_t child_pid,
do {
pid = waitpid(child_pid, &status, WUNTRACED);
} while (pid == -1 && errno == EINTR);
- signal(SIGCHLD, box->osigchld);
+ ssh_signal(SIGCHLD, box->osigchld);
if (!WIFSTOPPED(status)) {
if (WIFSIGNALED(status))
fatal("%s: child terminated with signal %d",