summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* arch: fix a problem with the rule rewrites in _seccomp_rule_add()Paul Moore2015-08-271-1/+1
| | | | | | | A typo was causing the return value from arch_fitler_rewrite() to be ignored in cases where -EDOM was returned. Signed-off-by: Paul Moore <pmoore@redhat.com>
* all: minor tweak to make astyle v2.05.1 happyPaul Moore2015-08-261-1/+0
| | | | Signed-off-by: Paul Moore <pmoore@redhat.com>
* build: fix == bashismMike Frysinger2015-08-241-1/+1
| | | | | | | | The test tool only has = for comparison, not ==. The latter is accepted by bash and other shells, but is not in POSIX. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Paul Moore <pmoore@redhat.com>
* tools: eliminate the shared exit_usage() functionPaul Moore2015-08-124-19/+30
| | | | | | I'm still not quite sure why this was shared in the first place. Signed-off-by: Paul Moore <pmoore@redhat.com>
* tools: support more LD modes in disassemblerDavid Drysdale2015-08-121-0/+24
| | | | | | | | | Add support for other modes for LD/LDX operations (even though they are rare in seccomp BPF programs), specifically BPF_IMM, BPF_IND, BPF_LEN and BPF_MSH. Signed-off-by: David Drysdale <drysdale@google.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
* tools: add Dot output option to scmp_bpf_disasmDavid Drysdale2015-08-121-72/+193
| | | | | | | | | | | | | | | | | Generate a rough program flowchart when '-d' option specified. This output can be converted into a graph with the Dot tool: % tests/02-sim-basic -b | tools/scmp_bpf_disasm -d | dot -Tpdf > out.pdf Details: - Add '-d' option to generate Dot output rather than listing. - Convert bpf_decode_op() to return string rather than printing, to allow re-use. - Encapsulate action string generation in bpf_decode_action() to allow re-use. Signed-off-by: David Drysdale <drysdale@google.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
* doc: include some direct subscription links for our mailing listPaul Moore2015-08-051-1/+2
| | | | | | As suggested by Nikos Mavrogiannopoulos. Signed-off-by: Paul Moore <pmoore@redhat.com>
* arch: update the syscall tables for 4.2-rc5Paul Moore2015-08-0511-11/+34
| | | | | | The only update this time around is "switch_endian" for ppc. Signed-off-by: Paul Moore <pmoore@redhat.com>
* Merge branch 'working-ppc64'Paul Moore2015-08-0534-11/+1468
|\ | | | | | | | | | | Mike Strosaker <strosake@linux.vnet.ibm.com> reports that the working-ppc64 branch is working for both 'make check' and './regression -T live'.
| * tests: add ppc support to the regression testsBogdan Purcareata2015-02-173-2/+6
| | | | | | | | | | Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
| * tools: add ppc supportBogdan Purcareata2015-02-174-0/+9
| | | | | | | | | | Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
| * arch: add basic initial ppc support to the arch-dependent codeBogdan Purcareata2015-02-173-1/+17
| | | | | | | | | | Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
| * arch: add a ppc syscall tableBogdan Purcareata2015-02-178-2/+623
| | | | | | | | | | | | Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com> [PM: slight reordering of ppc/ppc64 in header files and makefiles] Signed-off-by: Paul Moore <pmoore@redhat.com>
| * Merge branch 'master' into working-ppc64Paul Moore2015-02-1211-17/+50
| |\
| * | tests: minor fix in arch-syscall-checkBogdan Purcareata2015-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | Sent against working-ppc64. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
| * | ppc64: correct the ppc64 syscall table and validation scriptPaul Moore2015-02-102-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | We didn't correctly take into account the __powerpc64__ define when generating the ppc64 syscall table. This patch also updates the syscall table to match Linux v3.19. Signed-off-by: Paul Moore <pmoore@redhat.com>
| * | tests: add ppc64 support to the regression live testsBogdan Purcareata2015-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise The live tests will fail with "ERROR arch ppc64 not supported" Send against the working-ppc64 branch. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com> [PM: added ppc64le] Signed-off-by: Paul Moore <pmoore@redhat.com>
| * | tests: add ppc64 support to the regression testsPaul Moore2015-02-067-2/+20
| | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com>
| * | tools: add ppc64 supportPaul Moore2015-02-064-0/+20
| | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com>
| * | arch: add the basic initial support for ppc64 to the arch-dependent codePaul Moore2015-02-063-0/+30
| | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com>
| * | arch: add a ppc64 syscall tablePaul Moore2015-02-0617-7/+739
| | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | tests: don't link miniseq with any of our librariesPaul Moore2015-07-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When merging bfac175ac1222ca59045eeecd8d27df9dd7bab4d ("tests: fix sequence number generation") I mistakenly removed a line from the patch which kept us from linking miniseq with the various libseccomp libraries. Mathias did it correctly, I screwed it up; this patch should put things right. Reported-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | Revert "tests: workaround problems with large integers on 32-bit ARM"Mathias Krause2015-07-161-32/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit bca4e115715174a64c7b5f56430a51f3e676c34a. Now, since we're using a sane sequence number generator, we can re-enable the problematic test. Signed-off-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | tests: fix sequence number generationMathias Krause2015-07-164-9/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because of incorrect number sequence generation by seq(1) on at least 32 bit ARM systems using coreutils v8.23/v8.24 we provide a minimal seq(1) implementation that fits our needs. This fixes the bug mentioned in the following mailing thread: https://groups.google.com/forum/#!topic/libseccomp/VtrClkXxLGA Signed-off-by: Mathias Krause <minipli@googlemail.com> [PM: subject line, build locations, and vertical whitespace tweaks] Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | all: update CHANGELOG and version info for v2.2.3Paul Moore2015-07-081-0/+3
| | | | | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com> (imported from commit 7932b4fa24c1add0d7a315de8387d216334fbcf7)
* | | tests: workaround problems with large integers on 32-bit ARMPaul Moore2015-07-081-29/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See the mailing list thread below: -> https://groups.google.com/forum/#!topic/libseccomp/VtrClkXxLGA ... unfortunately the 32-bit ARM userspace has problems with this particular test so we need to disable it for the time being. It is important to note that this is only a problem with the test and not with libseccomp in general. Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | all: update CHANGELOG and version info for v2.2.2Paul Moore2015-07-061-4/+10
| | | | | | | | | | | | | | | | | | | | | Also correct some typos in the existing CHANGELOG entries. Signed-off-by: Paul Moore <pmoore@redhat.com> (imported from commit d7a29fefb03d9c3658854ea7b3cb6a8f082cfb90)
* | | db: optimize masked comparesMathias Krause2015-07-061-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the masked compare is a tautology we don't need to generate instructions for the runtime test. It'll always be true. This patch handles the case for 32 bit arches and partially for 64 bit arches. The cases where either the upper half or the lower half is a tautology is still TODO. Signed-off-by: Mathias Krause <minipli@googlemail.com> [PM: minor function name changes to better match existing style] Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | db: fix braino in _db_node_mask_fixup()Mathias Krause2015-07-061-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the mask is 0 and we do a masked compare we shouldn't "optimize" this case to a compare against zero. "(arg & 0) eq 0" != "(arg & ~0) eq 0". The former is a tautology while the latter depends on the value of "arg". Just mask "datum" instead to fix this bug. We'll do an unnecessary runtime test for the tautology in this case but follow up patches will take care of this. This fixes the failing test cases of 12-sim-basic_masked_ops with 64 bit argument values. Signed-off-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | tests: extend 12-sim-basic_masked_ops with 64 bit valuesMathias Krause2015-07-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add test vectors with bits set in the upper half of the syscall argument. They trigger a bug with mask values having the upper half set to 0. We accidentally emit a test for 0 in this case when we should not test the upper half at all. Signed-off-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | db: fix type of op in struct db_api_argMathias Krause2015-07-061-1/+1
| | | | | | | | | | | | | | | | | | | | | No need to use unsigned int here, use the enum instead. Signed-off-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | doc: update the CREDITS filePaul Moore2015-07-011-0/+3
| | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | tools: add the ability to fix syntax via the check-syntax toolPaul Moore2015-07-011-10/+54
| | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | arch: add the ability to dump the sycall definitions in arch-syscall-validatePaul Moore2015-07-011-23/+42
| | | | | | | | | | | | | | | | | | Also do some minor cleanup while we are touching the file. Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | arch: update the syscall validate script to reflect changes in x86Paul Moore2015-07-011-3/+3
| | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | arm: fix arm-specific syscall symbolsAndrew Jones2015-07-011-10/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | The symbols are prefixed with __ARM_NR_, not __NR_. We still shoehorn the symbols into the __NR_ format for libseccomp though. Doing so keeps SCMP_SYS simple. Signed-off-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | tests: add some tests missing from the MakefilePaul Moore2015-06-221-2/+6
| | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | bpf: fix x32/x86_64 architecture detection logicMathias Krause' via libseccomp2015-06-153-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test 28-sim-arch_x86 points out a flaw in the x32 arch handling as we wrongly jump to the next architecture check while we should jump to the bad_arch handling instruction instead. See below: $ ./tests/28-sim-arch_x86 -b | ./tools/scmp_bpf_disasm line OP JT JF K ================================= 0000: 0x20 0x00 0x00 0x00000004 ld $data[4] 0001: 0x15 0x00 0x03 0xc000003e jeq 3221225534 true:0002 false:0005 0002: 0x20 0x00 0x00 0x00000000 ld $data[0] 0003: 0x35 0x01 0x00 0x40000000 jge 1073741824 true:0005 false:0004 0004: 0x15 0x04 0x03 0x00000003 jeq 3 true:0009 false:0008 0005: 0x15 0x00 0x04 0x40000003 jeq 1073741827 true:0006 false:0010 0006: 0x20 0x00 0x00 0x00000000 ld $data[0] 0007: 0x15 0x01 0x00 0x00000006 jeq 6 true:0009 false:0008 0008: 0x06 0x00 0x00 0x7fff0000 ret ALLOW 0009: 0x06 0x00 0x00 0x00050001 ret ERRNO(1) 0010: 0x06 0x00 0x00 0x00000000 ret KILL When we reach the test at 0003 the accumulator register was changed from holding the audit architecture to contain the syscall number instead. This is needed to actually test for the x32 sub-architecture as it, unfortunately, got no dedicated audit arch value. However, if that test succeeds, we end up jumping to the next architecture check at 0005 which is wrong. We should jump to the bad_arch handling at 0010 instead as x32 is an unsupported architecture for that test program. Even worse, the next architecture check now operates on the wrong data as it's no longer testing the audit arch but the syscall number instead. As it happen to be, the syscall number for x32's close() is 0x40000003. That exactly matches the audit arch value for the x86 architecture. So what this filter does is allowing the x32 close() call while it should not. As we already successfully checked the arch to be SCMP_ARCH_X86_64 in 0001 it cannot have a different value. Testing for other values just makes no sense. So instead of reloading the accumulator register on a successful x32 test fix this by jumping to the bad_arch handling block instead. The generated BPF program now looks as follows: $ ./tests/28-sim-arch_x86 -b | ./tools/scmp_bpf_disasm line OP JT JF K ================================= 0000: 0x20 0x00 0x00 0x00000004 ld $data[4] 0001: 0x15 0x00 0x03 0xc000003e jeq 3221225534 true:0002 false:0005 0002: 0x20 0x00 0x00 0x00000000 ld $data[0] 0003: 0x35 0x06 0x00 0x40000000 jge 1073741824 true:0010 false:0004 0004: 0x15 0x04 0x03 0x00000003 jeq 3 true:0009 false:0008 0005: 0x15 0x00 0x04 0x40000003 jeq 1073741827 true:0006 false:0010 0006: 0x20 0x00 0x00 0x00000000 ld $data[0] 0007: 0x15 0x01 0x00 0x00000006 jeq 6 true:0009 false:0008 0008: 0x06 0x00 0x00 0x7fff0000 ret ALLOW 0009: 0x06 0x00 0x00 0x00050001 ret ERRNO(1) 0010: 0x06 0x00 0x00 0x00000000 ret KILL It now correctly jumps to the bad_arch handling at 0010 when the x32 test in 0003 succeeds. This fixes test 28-sim-arch_x86. Signed-off-by: Mathias Krause <minipli@googlemail.com> [PM: subject tweak, renamed 'bad_arch_hash' to 'bad_arch_hsh'] Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | tests: add a test for faulty handling of the x32 architectureMathias Krause' via libseccomp2015-06-155-1/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently allow calling close() on the x32 architecture when we're generating a blacklist filter for x86 and x86_64, i.e. one with an ALLOW policy. We shouldn't as the default handling for unsupported architectures should be defined by the bad_arch handling -- not the default policy. The reason for the faulty behaviour is the wrong jump target for the x32 architecture test. It should jump to the KILL label, not the next architecture test instruction. That one won't test the architecture any more as the accumulator register was already overwritten with the syscall number for the x32 test. This test generates a filter that should return ERRNO(1) on calls to close() for supported architectures or KILL on unsupported ones. But, currently, does not do so for x32 and ALLOWs the syscall instead. Signed-off-by: Mathias Krause <minipli@googlemail.com> [PM: added a python version of the test] Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | build: Fix srcdir != builddir from gitColin Walters2015-06-122-0/+3
| | | | | | | | | | | | | | | | | | | | | See https://github.com/cgwalters/build-api/blob/master/build-api.md Signed-off-by: Colin Walters <walters@verbum.org> Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | tests: make 27-sim-bpf_blk_state architecture independentPaul Moore2015-06-113-30/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | Using any of the socket related syscalls is always problematic, use a generic syscall number for this test since it isn't syscall specific. Reported-by: Jan Willeke <willeke@linux.vnet.ibm.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | all: update CHANGELOG and version info for v2.2.1Paul Moore2015-05-131-0/+6
| | | | | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com> (imported from commit f506e0844372b2c404baa482defb62f6846d0e3e)
* | | doc: update the CREDITS filePaul Moore2015-05-091-0/+1
| | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | doc: update the README based on feedback from the v2.2.0 releasePaul Moore2015-05-091-3/+18
| | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | docs: fix a number of problems in the function header commentsPaul Moore2015-05-095-12/+10
| | | | | | | | | | | | | | | Reported-by: Brian Cain <brian.cain@gmail.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | all: ensure the ARM and MIPS system defines are presentPaul Moore2015-05-072-18/+46
| | | | | | | | | | | | | | | | | | | | | | | | On some really old systems the ELF and or Audit ABI/arch defines are missing, this patch provides our own #defines in these cases. Reported-by: Vincent.Riera@imgtec.com Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | python: ensure attributes are treated as 32 bitsMike Strosaker2015-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Retrieving attributes using the Python bindings fails on some platforms. The attributes are encoded in a 32-bit mask. Python variables are usually larger (64 bits); Cython is not capable of recognizing that it should only use a 32-bit number on every platform. This patch ensures that the variable used to store the value of the attribute is only 32 bits. Signed-off-by: Michael Strosaker <strosake@linux.vnet.ibm.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | build: update the .gitignore file under tests/Paul Moore2015-05-061-0/+1
| | | | | | | | | | | | Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | arm: add some missing syscallsPaul Moore2015-05-0610-13/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the following syscalls to the ARM arch/ABI and update the syscall validation script. * breakpoint() * cacheflush() * usr26() * usr32() * set_tls() Reported-by: Purcareata Bogdan <b43198@freescale.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
* | | arm: fix some problems with the syscall tablePaul Moore2015-04-103-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 32-bit ARM syscall table mistakenly included syscall definitions for the syscalls below. This patch redefines those syscalls to libseccomp's pseudo-syscall numbers and corrects the arch-syscall-validate to correctly list the 32-bit ARM syscalls. * time * umount * stime * alarm * utime * getrlimit * select * readdir * mmap * socketcall * syscall * ipc Reported-by: Andreas Farber <afaerber@suse.de> Signed-off-by: Paul Moore <pmoore@redhat.com>