提交 c63cc8d1 编写于 作者: T Tycho Andersen 提交者: Greg Kroah-Hartman

selftests: skip seccomp get_metadata test if not real root

[ Upstream commit 3aa415dd2128e478ea3225b59308766de0e94d6b ]

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: NTycho Andersen <tycho@tycho.ws>
Acked-by: NKees Cook <keescook@chromium.org>
Signed-off-by: NShuah Khan <shuah@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 2df541d0
......@@ -2920,6 +2920,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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册