seccomp: Refactor the filter callback and the API
authorAndy Lutomirski <luto@amacapital.net>
Tue, 22 Jul 2014 01:49:15 +0000 (18:49 -0700)
committerKees Cook <keescook@chromium.org>
Wed, 3 Sep 2014 21:58:17 +0000 (14:58 -0700)
commit13aa72f0fd0a9f98a41cefb662487269e2f1ad65
treefbd7bf64cdc2b5d0f89c658ab784edad7fc1cff3
parenta4412fc9486ec85686c6c7929e7e829f62ae377e
seccomp: Refactor the filter callback and the API

The reason I did this is to add a seccomp API that will be usable
for an x86 fast path.  The x86 entry code needs to use a rather
expensive slow path for a syscall that might be visible to things
like ptrace.  By splitting seccomp into two phases, we can check
whether we need the slow path and then use the fast path in if the
filter allows the syscall or just returns some errno.

As a side effect, I think the new code is much easier to understand
than the old code.

This has one user-visible effect: the audit record written for
SECCOMP_RET_TRACE is now a simple indication that SECCOMP_RET_TRACE
happened.  It used to depend in a complicated way on what the tracer
did.  I couldn't make much sense of it.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Kees Cook <keescook@chromium.org>
include/linux/seccomp.h
kernel/seccomp.c