2 * Seccomp Library test program
4 * Author: Paul Moore <paul@paul-moore.com>, Vitaly Shukela <vi0oss@gmail.com>
8 * This library is free software; you can redistribute it and/or modify it
9 * under the terms of version 2.1 of the GNU Lesser General Public License as
10 * published by the Free Software Foundation.
12 * This library is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, see <http://www.gnu.org/licenses>.
28 int main(int argc
, char *argv
[])
31 struct util_options opts
;
32 scmp_filter_ctx ctx
= NULL
;
33 struct scmp_arg_cmp arg_cmp
;
35 rc
= util_getopt(argc
, argv
, &opts
);
39 ctx
= seccomp_init(SCMP_ACT_KILL
);
43 arg_cmp
= SCMP_A0(SCMP_CMP_EQ
, STDIN_FILENO
);
44 rc
= seccomp_rule_add_exact_array(ctx
, SCMP_ACT_ALLOW
,
45 SCMP_SYS(read
), 1, &arg_cmp
);
49 arg_cmp
= SCMP_A0(SCMP_CMP_EQ
, STDOUT_FILENO
);
50 rc
= seccomp_rule_add_exact_array(ctx
, SCMP_ACT_ALLOW
,
51 SCMP_SYS(write
), 1, &arg_cmp
);
55 arg_cmp
= SCMP_A0(SCMP_CMP_EQ
, STDERR_FILENO
);
56 rc
= seccomp_rule_add_exact_array(ctx
, SCMP_ACT_ALLOW
,
57 SCMP_SYS(write
), 1, &arg_cmp
);
61 rc
= seccomp_rule_add_exact_array(ctx
, SCMP_ACT_ALLOW
,
62 SCMP_SYS(close
), 0, NULL
);
66 rc
= seccomp_rule_add_exact_array(ctx
, SCMP_ACT_ALLOW
,
67 SCMP_SYS(rt_sigreturn
), 0, NULL
);
71 rc
= util_filter_output(&opts
, ctx
);
77 return (rc
< 0 ? -rc
: rc
);
This page took 0.020962 seconds and 4 git commands to generate.