1 From 068966cd0a774e6336ddb5424dd65341320b488b Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Mon, 28 Jan 2019 14:40:49 -0500
4 Subject: Revert "seccomp: add a selftest for get_metadata"
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 This reverts commit e65cd9a20343ea90f576c24c38ee85ab6e7d5fec.
11 Tommi T. Rrantala notes:
13 PTRACE_SECCOMP_GET_METADATA was only added in 4.16
14 (26500475ac1b499d8636ff281311d633909f5d20)
16 And it's also breaking seccomp_bpf.c compilation for me:
18 seccomp_bpf.c: In function ‘get_metadata’:
19 seccomp_bpf.c:2878:26: error: storage size of ‘md’ isn’t known
20 struct seccomp_metadata md;
22 Signed-off-by: Sasha Levin <sashal@kernel.org>
24 tools/testing/selftests/seccomp/seccomp_bpf.c | 61 -------------------
25 1 file changed, 61 deletions(-)
27 diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
28 index e350cf3d4f90..194759ec9e70 100644
29 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c
30 +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
31 @@ -145,15 +145,6 @@ struct seccomp_data {
32 #define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2)
35 -#ifndef PTRACE_SECCOMP_GET_METADATA
36 -#define PTRACE_SECCOMP_GET_METADATA 0x420d
38 -struct seccomp_metadata {
39 - __u64 filter_off; /* Input: which filter */
40 - __u64 flags; /* Output: filter's flags */
45 int seccomp(unsigned int op, unsigned int flags, void *args)
47 @@ -2870,58 +2861,6 @@ TEST(get_action_avail)
48 EXPECT_EQ(errno, EOPNOTSUPP);
56 - struct seccomp_metadata md;
58 - ASSERT_EQ(0, pipe(pipefd));
63 - struct sock_filter filter[] = {
64 - BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW),
66 - struct sock_fprog prog = {
67 - .len = (unsigned short)ARRAY_SIZE(filter),
71 - /* one with log, one without */
72 - ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER,
73 - SECCOMP_FILTER_FLAG_LOG, &prog));
74 - ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog));
76 - ASSERT_EQ(0, close(pipefd[0]));
77 - ASSERT_EQ(1, write(pipefd[1], "1", 1));
78 - ASSERT_EQ(0, close(pipefd[1]));
84 - ASSERT_EQ(0, close(pipefd[1]));
85 - ASSERT_EQ(1, read(pipefd[0], &buf, 1));
87 - ASSERT_EQ(0, ptrace(PTRACE_ATTACH, pid));
88 - ASSERT_EQ(pid, waitpid(pid, NULL, 0));
91 - ASSERT_EQ(sizeof(md), ptrace(PTRACE_SECCOMP_GET_METADATA, pid, sizeof(md), &md));
92 - EXPECT_EQ(md.flags, SECCOMP_FILTER_FLAG_LOG);
93 - EXPECT_EQ(md.filter_off, 0);
96 - ASSERT_EQ(sizeof(md), ptrace(PTRACE_SECCOMP_GET_METADATA, pid, sizeof(md), &md));
97 - EXPECT_EQ(md.flags, 0);
98 - EXPECT_EQ(md.filter_off, 1);
100 - ASSERT_EQ(0, kill(pid, SIGKILL));
105 * - add microbenchmarks