summaryrefslogtreecommitdiff
path: root/src/lib/sandbox/sandbox.c
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2021-10-14 13:01:41 +0000
committerAlexander Færøy <ahf@torproject.org>2021-10-14 13:01:41 +0000
commitc81901fd398c31b827db29e4d080407764619471 (patch)
tree07d8a6f8db56f61dd62fea0e3a89e9871d8caa40 /src/lib/sandbox/sandbox.c
parentd3c800866056575d5b115407d560c113104881df (diff)
parent7a06b8713dde2cf736c5fa0c70dae0f43fac81f1 (diff)
downloadtor-c81901fd398c31b827db29e4d080407764619471.tar.gz
tor-c81901fd398c31b827db29e4d080407764619471.zip
Merge remote-tracking branch 'tor-gitlab/mr/433' into main
Diffstat (limited to 'src/lib/sandbox/sandbox.c')
-rw-r--r--src/lib/sandbox/sandbox.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/sandbox/sandbox.c b/src/lib/sandbox/sandbox.c
index a78e4a7ac7..aed7e3706f 100644
--- a/src/lib/sandbox/sandbox.c
+++ b/src/lib/sandbox/sandbox.c
@@ -346,6 +346,7 @@ sb_rt_sigaction(scmp_filter_ctx ctx, sandbox_cfg_t *filter)
return rc;
}
+#ifdef __NR_time
/**
* Function responsible for setting up the time syscall for
* the seccomp filter sandbox.
@@ -354,13 +355,11 @@ static int
sb_time(scmp_filter_ctx ctx, sandbox_cfg_t *filter)
{
(void) filter;
-#ifdef __NR_time
+
return seccomp_rule_add_1(ctx, SCMP_ACT_ALLOW, SCMP_SYS(time),
SCMP_CMP(0, SCMP_CMP_EQ, 0));
-#else
- return 0;
-#endif /* defined(__NR_time) */
}
+#endif /* defined(__NR_time) */
/**
* Function responsible for setting up the accept4 syscall for
@@ -1264,7 +1263,9 @@ sb_kill(scmp_filter_ctx ctx, sandbox_cfg_t *filter)
static sandbox_filter_func_t filter_func[] = {
sb_rt_sigaction,
sb_rt_sigprocmask,
+#ifdef __NR_time
sb_time,
+#endif
sb_accept4,
#ifdef __NR_mmap2
sb_mmap2,