diff options
author | Tycho Andersen <tycho@tycho.ws> | 2019-01-18 17:12:15 -0700 |
---|---|---|
committer | Shuah Khan <shuah@kernel.org> | 2019-02-13 08:34:55 -0700 |
commit | 3aa415dd2128e478ea3225b59308766de0e94d6b (patch) | |
tree | 302cf0337ec125f571422db35a87d27af9008575 /tools | |
parent | a18261d71bbc625bc32abbcded71acc408cca393 (diff) | |
download | linux-3aa415dd2128e478ea3225b59308766de0e94d6b.tar.gz linux-3aa415dd2128e478ea3225b59308766de0e94d6b.tar.bz2 linux-3aa415dd2128e478ea3225b59308766de0e94d6b.zip |
selftests: skip seccomp get_metadata test if not real root
The get_metadata() test requires real root, so let's skip it if we're not
real root.
Note that I used XFAIL here because that's what the test does later if
CONFIG_CHEKCKPOINT_RESTORE happens to not be enabled. After looking at the
code, there doesn't seem to be a nice way to skip tests defined as TEST(),
since there's no return code (I tried exit(KSFT_SKIP), but that didn't work
either...). So let's do it this way to be consistent, and easier to fix
when someone comes along and fixes it.
Signed-off-by: Tycho Andersen <tycho@tycho.ws>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Shuah Khan <shuah@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/seccomp/seccomp_bpf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 01d1d06e3668..48354550d194 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -2971,6 +2971,12 @@ TEST(get_metadata) struct seccomp_metadata md; long ret; + /* Only real root can get metadata. */ + if (geteuid()) { + XFAIL(return, "get_metadata requires real root"); + return; + } + ASSERT_EQ(0, pipe(pipefd)); pid = fork(); |