]> git.ipfire.org Git - thirdparty/tor.git/commit
Introduce arg-counting macros to wrap seccomp_rule_add()
authorNick Mathewson <nickm@torproject.org>
Wed, 16 Apr 2014 16:59:33 +0000 (12:59 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 17 Apr 2014 02:03:09 +0000 (22:03 -0400)
commit8dc6755f6d65d7ff847bd5e8cf681e6de7fabbc5
treeeed5e8d60a86ff4f7c679c44ddd1286afe7fd300
parent12028c29e6ee8d0d9c02b32f1a52a35138e148e3
Introduce arg-counting macros to wrap seccomp_rule_add()

The compiler doesn't warn about this code:
       rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(openat), 1,
           SCMP_CMP(0, SCMP_CMP_EQ, AT_FDCWD),
           SCMP_CMP(1, SCMP_CMP_EQ, param->value),
           SCMP_CMP(2, SCMP_CMP_EQ, O_RDONLY|...));
but note that the arg_cnt argument above is only 1.  This means that
only the first filter (argument 0 == AT_FDCWD) is actually checked!

This patch also fixes the above error in the openat() filter.
Earlier I fixed corresponding errors in filters for rename() and
mprotect().
src/common/sandbox.c