tsync: fix cond_broadcast/wait race

It is possible for the second sibling to lose the race for the mutex
and miss one of the two cond_broadcast events. Detect this, and lower
the num_waits manually when shutting down the sibling.

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

tsync: fix cond_broadcast/wait race
tests: check that fixture can detect prctl errors

This tests that prctl errors in threads will be reported correctly,
as fixed in "tsync: unlock mutex on failure".

Signed-off-by: Kees Cook <keescook@chromium.org>
tests: make sure spawned process can report status

If the spawned tracer fails and tests, communicate that back to the
spawner so the test will be reported as failing at the top-level.

Signed-off-by: Kees Cook <keescook@chromium.org>
tests: make sure events are from SECCOMP

Makes sure that the PTRACE_EVENT_SECCOMP value is correct and that is
is being passed by the kernel on ptrace events.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1326905

Signed-off-by: Kees Cook <keescook@chromium.org>
tests: run tests in source declaration order

Since the constructor was calling registration, the test list needed to be
explicitly built in reverse.

Signed-off-by: Kees Cook <keescook@chromium.org>
tests: convert from ACT_EXT_TSYNC to syscall

Converts tests to use new seccomp syscall instead of prctl. Also removes
logic expecing side-effects from TSYNC failure.

Signed-off-by: Kees Cook <keescook@chromium.org>
tests: add test for mode locking

Make sure the seccomp mode can't change.

Signed-off-by: Kees Cook <keescook@chromium.org>
tests: clean up sibling exit defines

Make sure the sibling exit codes are reachable and easier to understand.

Signed-off-by: Kees Cook <keescook@chromium.org>