]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Sandbox: permit O_NONBLOCK and O_NOCTTY for files we refuse
authorNick Mathewson <nickm@torproject.org>
Thu, 17 Apr 2014 01:50:49 +0000 (21:50 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 17 Apr 2014 02:03:18 +0000 (22:03 -0400)
OpenSSL needs this, or RAND_poll() will kill the process.

Also, refuse with EACCESS, not errno==-1 (!).

src/common/sandbox.c

index 0722751745313f1c8b5cf30811bdf48587e7cd81..7067a72c7de744b05492251525dd0b797f050aea 100644 (file)
@@ -363,8 +363,8 @@ sb_open(scmp_filter_ctx ctx, sandbox_cfg_t *filter)
     }
   }
 
-  rc = seccomp_rule_add_1(ctx, SCMP_ACT_ERRNO(-1), SCMP_SYS(open),
-                          SCMP_CMP_MASKED(1, O_CLOEXEC, O_RDONLY));
+  rc = seccomp_rule_add_1(ctx, SCMP_ACT_ERRNO(EACCES), SCMP_SYS(open),
+                SCMP_CMP_MASKED(1, O_CLOEXEC|O_NONBLOCK|O_NOCTTY, O_RDONLY));
   if (rc != 0) {
     log_err(LD_BUG,"(Sandbox) failed to add open syscall, received libseccomp "
         "error %d", rc);