Skip to content

Commit 41d3c75

Browse files
shunghsiyugregkh
authored andcommitted
Revert "selftests/bpf: Add a cgroup prog bpf_get_ns_current_pid_tgid() test"
This reverts commit 4730b07. The test depends on commit eb166e5 "bpf: Allow helper bpf_get_[ns_]current_pid_tgid() for all prog types", which was not part of the stable 6.6 code base, and thus the test will fail. Revert it since it is a false positive. Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1af6d16 commit 41d3c75

2 files changed

Lines changed: 0 additions & 80 deletions

File tree

tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <sys/wait.h>
1313
#include <sys/mount.h>
1414
#include <fcntl.h>
15-
#include "network_helpers.h"
1615

1716
#define STACK_SIZE (1024 * 1024)
1817
static char child_stack[STACK_SIZE];
@@ -75,50 +74,6 @@ static int test_current_pid_tgid_tp(void *args)
7574
return ret;
7675
}
7776

78-
static int test_current_pid_tgid_cgrp(void *args)
79-
{
80-
struct test_ns_current_pid_tgid__bss *bss;
81-
struct test_ns_current_pid_tgid *skel;
82-
int server_fd = -1, ret = -1, err;
83-
int cgroup_fd = *(int *)args;
84-
pid_t tgid, pid;
85-
86-
skel = test_ns_current_pid_tgid__open();
87-
if (!ASSERT_OK_PTR(skel, "test_ns_current_pid_tgid__open"))
88-
return ret;
89-
90-
bpf_program__set_autoload(skel->progs.cgroup_bind4, true);
91-
92-
err = test_ns_current_pid_tgid__load(skel);
93-
if (!ASSERT_OK(err, "test_ns_current_pid_tgid__load"))
94-
goto cleanup;
95-
96-
bss = skel->bss;
97-
if (get_pid_tgid(&pid, &tgid, bss))
98-
goto cleanup;
99-
100-
skel->links.cgroup_bind4 = bpf_program__attach_cgroup(
101-
skel->progs.cgroup_bind4, cgroup_fd);
102-
if (!ASSERT_OK_PTR(skel->links.cgroup_bind4, "bpf_program__attach_cgroup"))
103-
goto cleanup;
104-
105-
server_fd = start_server(AF_INET, SOCK_STREAM, NULL, 0, 0);
106-
if (!ASSERT_GE(server_fd, 0, "start_server"))
107-
goto cleanup;
108-
109-
if (!ASSERT_EQ(bss->user_pid, pid, "pid"))
110-
goto cleanup;
111-
if (!ASSERT_EQ(bss->user_tgid, tgid, "tgid"))
112-
goto cleanup;
113-
ret = 0;
114-
115-
cleanup:
116-
if (server_fd >= 0)
117-
close(server_fd);
118-
test_ns_current_pid_tgid__destroy(skel);
119-
return ret;
120-
}
121-
12277
static void test_ns_current_pid_tgid_new_ns(int (*fn)(void *), void *arg)
12378
{
12479
int wstatus;
@@ -140,39 +95,11 @@ static void test_ns_current_pid_tgid_new_ns(int (*fn)(void *), void *arg)
14095
return;
14196
}
14297

143-
static void test_in_netns(int (*fn)(void *), void *arg)
144-
{
145-
struct nstoken *nstoken = NULL;
146-
147-
SYS(cleanup, "ip netns add ns_current_pid_tgid");
148-
SYS(cleanup, "ip -net ns_current_pid_tgid link set dev lo up");
149-
150-
nstoken = open_netns("ns_current_pid_tgid");
151-
if (!ASSERT_OK_PTR(nstoken, "open_netns"))
152-
goto cleanup;
153-
154-
test_ns_current_pid_tgid_new_ns(fn, arg);
155-
156-
cleanup:
157-
if (nstoken)
158-
close_netns(nstoken);
159-
SYS_NOFAIL("ip netns del ns_current_pid_tgid");
160-
}
161-
16298
/* TODO: use a different tracepoint */
16399
void serial_test_ns_current_pid_tgid(void)
164100
{
165101
if (test__start_subtest("root_ns_tp"))
166102
test_current_pid_tgid_tp(NULL);
167103
if (test__start_subtest("new_ns_tp"))
168104
test_ns_current_pid_tgid_new_ns(test_current_pid_tgid_tp, NULL);
169-
if (test__start_subtest("new_ns_cgrp")) {
170-
int cgroup_fd = -1;
171-
172-
cgroup_fd = test__join_cgroup("/sock_addr");
173-
if (ASSERT_GE(cgroup_fd, 0, "join_cgroup")) {
174-
test_in_netns(test_current_pid_tgid_cgrp, &cgroup_fd);
175-
close(cgroup_fd);
176-
}
177-
}
178105
}

tools/testing/selftests/bpf/progs/test_ns_current_pid_tgid.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,4 @@ int tp_handler(const void *ctx)
2828
return 0;
2929
}
3030

31-
SEC("?cgroup/bind4")
32-
int cgroup_bind4(struct bpf_sock_addr *ctx)
33-
{
34-
get_pid_tgid();
35-
return 1;
36-
}
37-
3831
char _license[] SEC("license") = "GPL";

0 commit comments

Comments
 (0)