summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-07-13 09:19:29 -0400
committerNick Mathewson <nickm@torproject.org>2016-07-13 09:19:29 -0400
commit449c61f452db7a0736a0654ce3290ce0ea76cd40 (patch)
treeb484c8db7e63cf393c14df85f3c45dcda8ea8daa
parent35a5a1b6330f170f1838e6dbc77a9c035ef0ad33 (diff)
parentc1bfa65211257e5efb89c5ebc534339d52fa77c4 (diff)
downloadtor-449c61f452db7a0736a0654ce3290ce0ea76cd40.tar.gz
tor-449c61f452db7a0736a0654ce3290ce0ea76cd40.zip
Merge branch 'maint-0.2.8' into release-0.2.8
-rw-r--r--changes/bug183977
-rw-r--r--src/common/sandbox.c20
2 files changed, 27 insertions, 0 deletions
diff --git a/changes/bug18397 b/changes/bug18397
new file mode 100644
index 0000000000..53993da4e6
--- /dev/null
+++ b/changes/bug18397
@@ -0,0 +1,7 @@
+ o Minor bugfixes (Linux seccomp2 sandbox):
+ - Add a few missing syscalls to the seccomp2 sandbox: sysinfo,
+ getsockopt(SO_SNDBUF), and setsockopt(SO_SNDBUFFORCE). On
+ some systems, these are required for Tor to start with
+ "Sandbox 1" enabled.
+ Fixes bug 18397; bugfix on 0.2.5.1-alpha. Patch from
+ Daniel Pinto.
diff --git a/src/common/sandbox.c b/src/common/sandbox.c
index 70c5bbd07c..c0b994b3e8 100644
--- a/src/common/sandbox.c
+++ b/src/common/sandbox.c
@@ -212,6 +212,10 @@ static int filter_nopar_gen[] = {
SCMP_SYS(getrandom),
#endif
+#ifdef __NR_sysinfo
+ // qsort uses this..
+ SCMP_SYS(sysinfo),
+#endif
/*
* These socket syscalls are not required on x86_64 and not supported with
* some libseccomp versions (eg: 1.0.1)
@@ -701,6 +705,14 @@ sb_setsockopt(scmp_filter_ctx ctx, sandbox_cfg_t *filter)
if (rc)
return rc;
+#ifdef HAVE_SYSTEMD
+ rc = seccomp_rule_add_2(ctx, SCMP_ACT_ALLOW, SCMP_SYS(setsockopt),
+ SCMP_CMP(1, SCMP_CMP_EQ, SOL_SOCKET),
+ SCMP_CMP(2, SCMP_CMP_EQ, SO_SNDBUFFORCE));
+ if (rc)
+ return rc;
+#endif
+
#ifdef IP_TRANSPARENT
rc = seccomp_rule_add_2(ctx, SCMP_ACT_ALLOW, SCMP_SYS(setsockopt),
SCMP_CMP(1, SCMP_CMP_EQ, SOL_IP),
@@ -734,6 +746,14 @@ sb_getsockopt(scmp_filter_ctx ctx, sandbox_cfg_t *filter)
if (rc)
return rc;
+#ifdef HAVE_SYSTEMD
+ rc = seccomp_rule_add_2(ctx, SCMP_ACT_ALLOW, SCMP_SYS(getsockopt),
+ SCMP_CMP(1, SCMP_CMP_EQ, SOL_SOCKET),
+ SCMP_CMP(2, SCMP_CMP_EQ, SO_SNDBUF));
+ if (rc)
+ return rc;
+#endif
+
#ifdef HAVE_LINUX_NETFILTER_IPV4_H
rc = seccomp_rule_add_2(ctx, SCMP_ACT_ALLOW, SCMP_SYS(getsockopt),
SCMP_CMP(1, SCMP_CMP_EQ, SOL_IP),