Skip to content
  • Nick Mathewson's avatar
    Introduce arg-counting macros to wrap seccomp_rule_add() · 8dc6755f
    Nick Mathewson authored
    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().
    8dc6755f