summaryrefslogtreecommitdiff
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorSasha Levin <sashal@kernel.org>2019-01-28 14:40:49 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-31 08:13:46 +0100
commitc3ca9064273c3d7bc1654d685d42f41ccf3744d7 (patch)
tree3fd6bf308ecee9207db498b5c0b137c90eb55140 /tools/testing/selftests
parentdbf8065943de648d04d820d4a7e9407986eb31c6 (diff)
Revert "seccomp: add a selftest for get_metadata"
This reverts commit e65cd9a20343ea90f576c24c38ee85ab6e7d5fec. Tommi T. Rrantala notes: PTRACE_SECCOMP_GET_METADATA was only added in 4.16 (26500475ac1b499d8636ff281311d633909f5d20) And it's also breaking seccomp_bpf.c compilation for me: seccomp_bpf.c: In function ‘get_metadata’: seccomp_bpf.c:2878:26: error: storage size of ‘md’ isn’t known struct seccomp_metadata md; Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/testing/selftests')
-rw-r--r--tools/testing/selftests/seccomp/seccomp_bpf.c61
1 files changed, 0 insertions, 61 deletions
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index e350cf3d4f90..194759ec9e70 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -145,15 +145,6 @@ struct seccomp_data {
#define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2)
#endif
-#ifndef PTRACE_SECCOMP_GET_METADATA
-#define PTRACE_SECCOMP_GET_METADATA 0x420d
-
-struct seccomp_metadata {
- __u64 filter_off; /* Input: which filter */
- __u64 flags; /* Output: filter's flags */
-};
-#endif
-
#ifndef seccomp
int seccomp(unsigned int op, unsigned int flags, void *args)
{
@@ -2870,58 +2861,6 @@ TEST(get_action_avail)
EXPECT_EQ(errno, EOPNOTSUPP);
}
-TEST(get_metadata)
-{
- pid_t pid;
- int pipefd[2];
- char buf;
- struct seccomp_metadata md;
-
- ASSERT_EQ(0, pipe(pipefd));
-
- pid = fork();
- ASSERT_GE(pid, 0);
- if (pid == 0) {
- struct sock_filter filter[] = {
- BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW),
- };
- struct sock_fprog prog = {
- .len = (unsigned short)ARRAY_SIZE(filter),
- .filter = filter,
- };
-
- /* one with log, one without */
- ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER,
- SECCOMP_FILTER_FLAG_LOG, &prog));
- ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog));
-
- ASSERT_EQ(0, close(pipefd[0]));
- ASSERT_EQ(1, write(pipefd[1], "1", 1));
- ASSERT_EQ(0, close(pipefd[1]));
-
- while (1)
- sleep(100);
- }
-
- ASSERT_EQ(0, close(pipefd[1]));
- ASSERT_EQ(1, read(pipefd[0], &buf, 1));
-
- ASSERT_EQ(0, ptrace(PTRACE_ATTACH, pid));
- ASSERT_EQ(pid, waitpid(pid, NULL, 0));
-
- md.filter_off = 0;
- ASSERT_EQ(sizeof(md), ptrace(PTRACE_SECCOMP_GET_METADATA, pid, sizeof(md), &md));
- EXPECT_EQ(md.flags, SECCOMP_FILTER_FLAG_LOG);
- EXPECT_EQ(md.filter_off, 0);
-
- md.filter_off = 1;
- ASSERT_EQ(sizeof(md), ptrace(PTRACE_SECCOMP_GET_METADATA, pid, sizeof(md), &md));
- EXPECT_EQ(md.flags, 0);
- EXPECT_EQ(md.filter_off, 1);
-
- ASSERT_EQ(0, kill(pid, SIGKILL));
-}
-
/*
* TODO:
* - add microbenchmarks