]>
Commit | Line | Data |
---|---|---|
8befd5cc MG |
1 | #!/usr/bin/env python |
2 | ||
3 | # | |
4 | # Seccomp Library test program | |
5 | # | |
6 | # Author: Markos Chandras <markos.chandras@imgtec.com> | |
7 | # | |
8 | ||
9 | # | |
10 | # This library is free software; you can redistribute it and/or modify it | |
11 | # under the terms of version 2.1 of the GNU Lesser General Public License as | |
12 | # published by the Free Software Foundation. | |
13 | # | |
14 | # This library is distributed in the hope that it will be useful, but WITHOUT | |
15 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License | |
17 | # for more details. | |
18 | # | |
19 | # You should have received a copy of the GNU Lesser General Public License | |
20 | # along with this library; if not, see <http://www.gnu.org/licenses>. | |
21 | # | |
22 | ||
23 | import argparse | |
24 | import sys | |
25 | ||
26 | import util | |
27 | ||
28 | from seccomp import * | |
29 | ||
30 | def test(args): | |
31 | f = SyscallFilter(KILL) | |
32 | f.remove_arch(Arch()) | |
33 | f.add_arch(Arch("mips")) | |
34 | f.add_arch(Arch("mips64")) | |
35 | f.add_arch(Arch("mips64n32")) | |
36 | f.add_arch(Arch("ppc")) | |
37 | f.add_arch(Arch("ppc64")) | |
38 | f.add_arch(Arch("s390")) | |
39 | f.add_arch(Arch("s390x")) | |
40 | f.add_rule(ALLOW, "read", Arg(0, EQ, sys.stdin.fileno())) | |
41 | f.add_rule(ALLOW, "write", Arg(0, EQ, sys.stdout.fileno())) | |
42 | f.add_rule(ALLOW, "write", Arg(0, EQ, sys.stderr.fileno())) | |
43 | f.add_rule(ALLOW, "close") | |
44 | f.add_rule(ALLOW, "rt_sigreturn") | |
45 | return f | |
46 | ||
47 | args = util.get_opt() | |
48 | ctx = test(args) | |
49 | util.filter_output(args, ctx) | |
50 | ||
51 | # kate: syntax python; | |
52 | # kate: indent-mode python; space-indent on; indent-width 4; mixedindent off; |