seccomp: Selftest for detection of filter flag support
authorTyler Hicks <tyhicks@canonical.com>
Fri, 11 Aug 2017 04:33:55 +0000 (04:33 +0000)
committerKees Cook <keescook@chromium.org>
Mon, 14 Aug 2017 20:46:46 +0000 (13:46 -0700)
commit2b7ea5b5b5799f2878ed454bb48032bed6d101d3
tree5aaae1f8f90097ea54686faa783ac0e72b851e3f
parent0ddec0fc8900201c0897b87b762b7c420436662f
seccomp: Selftest for detection of filter flag support

Userspace needs to be able to reliably detect the support of a filter
flag. A good way of doing that is by attempting to enter filter mode,
with the flag bit(s) in question set, and a NULL pointer for the args
parameter of seccomp(2). EFAULT indicates that the flag is valid and
EINVAL indicates that the flag is invalid.

This patch adds a selftest that can be used to test this method of
detection in userspace.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
tools/testing/selftests/seccomp/seccomp_bpf.c