On Thursday, March 21, 2013 08:51:36 PM [email protected] wrote: > From: Vitaly _Vi Shukela <[email protected]> > > Like 03-sim-basic_chains, but with seccomp_rule_add_array instead of > seccomp_rule_add.
The whitespace and alignment problems are particularly bad with this patch. The python version of the test is also missing. More comments inline ... > diff --git a/tests/.gitignore b/tests/.gitignore > index 8bbb158..3b68512 100644 > --- a/tests/.gitignore > +++ b/tests/.gitignore > @@ -22,3 +22,4 @@ util.pyc > 19-sim-missing_syscalls > 20-live-basic_die > 21-live-basic_allow > +22-sim-basic_chains_array > diff --git a/tests/22-sim-basic_chains_array.c > b/tests/22-sim-basic_chains_array.c new file mode 100644 > index 0000000..ae334d9 > --- /dev/null > +++ b/tests/22-sim-basic_chains_array.c > @@ -0,0 +1,89 @@ > +/** > + * Seccomp Library test program > + * > + * Copyright (c) 2012 Red Hat <[email protected]> > + * Author: Paul Moore <[email protected]>, Vitaly Shukela > <[email protected]> > + */ We should update the copyright date to 2013, optionally you could have taken ownership but I don't think it matter too much here. > +#include <unistd.h> > + > +#include <seccomp.h> > + > +#include "util.h" > + > +int main(int argc, char *argv[]) > +{ > + int rc; > + struct util_options opts; > + scmp_filter_ctx ctx; > + > + rc = util_getopt(argc, argv, &opts); > + if (rc < 0) > + goto out; > + > + ctx = seccomp_init(SCMP_ACT_KILL); > + if (ctx == NULL) > + goto out; > + > + { > + struct scmp_arg_cmp filters[] = { SCMP_A0(SCMP_CMP_EQ, > STDIN_FILENO) }; > + rc = seccomp_rule_add_exact_array(ctx, SCMP_ACT_ALLOW, > + SCMP_SYS(read), 1, filters); > + } Hmmm, I'm not really a fan of this approach using braces to create a new scope. > diff --git a/tests/22-sim-basic_chains_array.tests > b/tests/22-sim-basic_chains_array.tests new file mode 100644 > index 0000000..e664687 > --- /dev/null > +++ b/tests/22-sim-basic_chains_array.tests > @@ -0,0 +1,27 @@ > +# > +# libseccomp regression test automation data > +# > +# Copyright IBM Corp. 2012 > +# Author: Corey Bryant <[email protected]> > +# You are not Corey. > +test type: bpf-sim > + > +# Testname Arch Syscall Arg0 Arg1 > Arg2 Arg3 Arg4 Arg5 Result Alignment is off. > +22-sim-basic_chains_array all read 0 > 0x856B008 10 N N N ALLOW > +22-sim-basic_chains_array all read 1-10 > 0x856B008 10 N N N KILL > +22-sim-basic_chains_array all write 1-2 > 0x856B008 10 N N N ALLOW > +22-sim-basic_chains_array all write 3-10 > 0x856B008 10 N N N KILL > +22-sim-basic_chains_array all close N N > N N N N ALLOW > +22-sim-basic_chains_array all rt_sigreturn N N > N N N N ALLOW > +22-sim-basic_chains_array all open 0x856B008 4 > N N N N KILL > +22-sim-basic_chains_array x86 0-2 N N > N N N N KILL > +22-sim-basic_chains_array x86 7-172 N N > N N N N KILL > +22-sim-basic_chains_array x86 174-350 N N > N N N N KILL > +22-sim-basic_chains_array x86_64 4-14 N N > N N N N KILL > +22-sim-basic_chains_array x86_64 16-350 N N > N N N N KILL > + > +test type: bpf-sim-fuzz > + > +# Testname StressCount > +22-sim-basic_chains_array 50 > diff --git a/tests/Makefile b/tests/Makefile > index 5d0a16f..57b7b5f 100644 > --- a/tests/Makefile > +++ b/tests/Makefile > @@ -56,7 +56,8 @@ TESTS = 01-sim-allow \ > 18-sim-basic_whitelist \ > 19-sim-missing_syscalls \ > 20-live-basic_die \ > - 21-live-basic_allow > + 21-live-basic_allow \ > + 22-sim-basic_chains_array > > DEPS_OBJS = $(OBJS:%.o=%.d) > DEPS_TESTS = $(TESTS:%=%.d) -- paul moore security and virtualization @ redhat ------------------------------------------------------------------------------ Own the Future-Intel® Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d _______________________________________________ libseccomp-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libseccomp-discuss
