all: apply basic formatting fixes to src/hash.c

There is still a lot of style/formatting work that should probably
be done to this file, but this cleans it up enough so it passes our
basic style checks.

Signed-off-by: Paul Moore <pmoore@redhat.com>
hash: cleanup the Jenkins hash source to better match our code

Style improvements as well as a wrapper function to select the "best"
hash for a given situation.  Some unused functions were also removed.

Signed-off-by: Paul Moore <pmoore@redhat.com>
tests: fix a problem with the python bindings and the bpf-valgrind tests

Reported-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Paul Moore <pmoore@redhat.com>
python: Remove file object support from Arg

It's still possible to pass file descriptors into the Arg data, but safe
uses are already complicated enough that making the user call fileno()
themselves seems reasonable.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
(corrected the python test cases to take into account the change)
Signed-off-by: Paul Moore <pmoore@redhat.com>
build: Hide non-public symbols

Set -fvisibility=hidden and explicitly unhide public APIs.  This overrides
it with -fvisibility=default for Python because otherwise initseccomp
gets hidden and the module won't load.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
(minor style fixes and macro renames)
Signed-off-by: Paul Moore <pmoore@redhat.com>
api: fix some vertical whitespace mistakes

Signed-off-by: Paul Moore <pmoore@redhat.com>
Add seccomp_sigsys_decode

This will decode a SIGSYS to a struct seccomp_data.  It shows the raw
(untranslated) values as opposed to the translated values.  For example,
socketcall will show up as socketcall.

So far, this supports x86_64 native and i386 on x86_64.  (The latter
is unlikely to happen without either some kind of thunk library to load
32-bit code into a 64-bit process or explicit invocations of compat syscalls
from 64-bit code.)  It should also work on x32, although I haven't tested
it.

On ARM, seccomp_sigsys_decode will return -EOPNOTSUPP.  That means that
the new test will fail.  It should be very easy to add ARM support (it
should be modeled after the i386 code), but I'm not set up to be able
to test on ARM.

(NB: ARM, in theory, supports syscalls with seven arguments.  AFAICS there are
no such syscalls, and the kernel seccomp code wouldn't really support them
anyway.)

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Add ARM syscall decoding