build: add -Wall and clean up warnings

This fixes or silences various warnings noticed by -Wall.

Signed-off-by: Kees Cook <keescook@chromium.org>
tests: shut down tracer on unknown events

If the tracer doesn't shut down on unknown events, it can potentially
spin forever.

Signed-off-by: Kees Cook <keescook@chromium.org>
tests: refactor tracer for additional tracer tests

This moves the test logic of the tracer into a separate function so it can
be reused by other tracing tests.

Signed-off-by: Kees Cook <keescook@chromium.org>
tests: add syscall redirection validation

This makes sure that TRACE filters can allow, change, and skip syscalls.

Signed-off-by: Kees Cook <keescook@chromium.org>
tests: check maximum filter sizes

Make sure that individual filters and total filter chain counts cannot
exceed expected lengths.

Signed-off-by: Kees Cook <keescook@chromium.org>
Merge pull request #9 from kees/trace

Trace
tests: run-time detect constructor order

It seems not all toolchains actually run constructors in reverse. To
make sure we get tests run in source order, detect which direction
constructors are executed in, and adjust the list building logic.

Signed-off-by: Kees Cook <keescook@chromium.org>
tests: add ARM seccomp syscall number

Add expected syscall number for seccomp on ARM.

Signed-off-by: Kees Cook <keescook@chromium.org>
tests: make sure TSYNC can be used on first filter

There was an unneeded sanity check in the TSYNC logic that was causing
the first installed filter to not allow TSYNC to be used.

Reported-by: David Drysdale <drysdale@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
tests: Add test of PR_GET_SECCOMP

Check that the seccomp mode is 0 before doing anything
and is 2 after setting filter mode.

Can't check on a seccomp mode of 1 because strict mode
doesn't allow the prctl(2) call.

Signed-off-by: David Drysdale <drysdale@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
tests: validate pre-existing threads get nnp and filter

Makes sure that nnp gets set on threads getting TSYNCed.

Signed-off-by: David Drysdale <drysdale@google.com>
[added test for framework detecting lack of nnp]
Signed-off-by: Kees Cook <keescook@chromium.org>
tests: add run_tests target and .gitignore

In preparation for putting into upstream kernel tree, add targets.

Signed-off-by: David Drysdale <drysdale@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
tests: add aarch64 support

This switches to using GET/SETREGSET which should work on all archs, and
adds support for aarch64.

Based on patch by AKASHI Takahiro <takahiro.akashi@linaro.org>.

Signed-off-by: Kees Cook <keescook@chromium.org>
Merge pull request #10 from kees/trace

test order and ARM seccomp syscall