]>
iEval git - linux-seccomp.git/blob - libseccomp/tests/26-sim-arch_all_be_basic.c
2 * Seccomp Library test program
4 * Author: Markos Chandras <markos.chandras@imgtec.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
;
34 rc
= util_getopt(argc
, argv
, &opts
);
38 ctx
= seccomp_init(SCMP_ACT_KILL
);
42 rc
= seccomp_arch_remove(ctx
, SCMP_ARCH_NATIVE
);
46 rc
= seccomp_arch_add(ctx
, seccomp_arch_resolve_name("mips"));
49 rc
= seccomp_arch_add(ctx
, seccomp_arch_resolve_name("mips64"));
52 rc
= seccomp_arch_add(ctx
, seccomp_arch_resolve_name("mips64n32"));
55 rc
= seccomp_arch_add(ctx
, seccomp_arch_resolve_name("ppc"));
58 rc
= seccomp_arch_add(ctx
, seccomp_arch_resolve_name("ppc64"));
61 rc
= seccomp_arch_add(ctx
, seccomp_arch_resolve_name("s390"));
64 rc
= seccomp_arch_add(ctx
, seccomp_arch_resolve_name("s390x"));
68 rc
= seccomp_rule_add(ctx
, SCMP_ACT_ALLOW
, SCMP_SYS(read
), 1,
69 SCMP_A0(SCMP_CMP_EQ
, STDIN_FILENO
));
73 rc
= seccomp_rule_add(ctx
, SCMP_ACT_ALLOW
, SCMP_SYS(write
), 1,
74 SCMP_A0(SCMP_CMP_EQ
, STDOUT_FILENO
));
78 rc
= seccomp_rule_add(ctx
, SCMP_ACT_ALLOW
, SCMP_SYS(write
), 1,
79 SCMP_A0(SCMP_CMP_EQ
, STDERR_FILENO
));
83 rc
= seccomp_rule_add(ctx
, SCMP_ACT_ALLOW
, SCMP_SYS(close
), 0);
87 rc
= seccomp_rule_add(ctx
, SCMP_ACT_ALLOW
, SCMP_SYS(rt_sigreturn
), 0);
91 rc
= util_filter_output(&opts
, ctx
);
97 return (rc
< 0 ? -rc
: rc
);
This page took 0.04784 seconds and 4 git commands to generate.