2 * Seccomp Library test program
4 * This test triggered a bug in libseccomp erroneously allowing the close()
5 * syscall on x32 instead of 'KILL'ing it, as it should do for unsupported
8 * Copyright (c) 2012 Red Hat <pmoore@redhat.com>
9 * Authors: Paul Moore <pmoore@redhat.com>
10 * Mathias Krause <minipli@googlemail.com>
14 * This library is free software; you can redistribute it and/or modify it
15 * under the terms of version 2.1 of the GNU Lesser General Public License as
16 * published by the Free Software Foundation.
18 * This library is distributed in the hope that it will be useful, but WITHOUT
19 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with this library; if not, see <http://www.gnu.org/licenses>.
34 int main(int argc
, char *argv
[])
37 struct util_options opts
;
38 scmp_filter_ctx ctx
= NULL
;
40 rc
= util_getopt(argc
, argv
, &opts
);
44 ctx
= seccomp_init(SCMP_ACT_ALLOW
);
48 rc
= seccomp_arch_remove(ctx
, SCMP_ARCH_NATIVE
);
52 /* add x86-64 and x86 (in that order!) but explicitly leave out x32 */
53 rc
= seccomp_arch_add(ctx
, SCMP_ARCH_X86_64
);
56 rc
= seccomp_arch_add(ctx
, SCMP_ARCH_X86
);
60 rc
= seccomp_rule_add(ctx
, SCMP_ACT_ERRNO(1), SCMP_SYS(close
), 0);
64 rc
= util_filter_output(&opts
, ctx
);
70 return (rc
< 0 ? -rc
: rc
);
This page took 0.022145 seconds and 4 git commands to generate.