
Offering: HULK hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IBIYG4 -------------------------------- LTS commit 27ea1a6931df ("[Backport] selftests/bpf: fix perf_event link info name_len assertion") was backported with stable depend patches: - commit 3b090f4cd4d5 ("[Backport] selftests/bpf: Add cookies check for perf_event fill_link_info test") - commit 0ed80b43ed34 ("[Backport] selftests/bpf: Use bpf_link__destroy in fill_link_info tests") However, we do not need these two depend patches and they will cause compiling error of bpf selftests. So let's revert these patches and re-adapt the target commit. Fixes: 3b090f4cd4d5 ("[Backport] selftests/bpf: Add cookies check for perf_event fill_link_info test") Signed-off-by: Xiaomeng Zhang <zhangxiaomeng13@huawei.com> --- .../selftests/bpf/prog_tests/fill_link_info.c | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/fill_link_info.c b/tools/testing/selftests/bpf/prog_tests/fill_link_info.c index e81f4d114c7a..d07ac9f3de78 100644 --- a/tools/testing/selftests/bpf/prog_tests/fill_link_info.c +++ b/tools/testing/selftests/bpf/prog_tests/fill_link_info.c @@ -30,8 +30,6 @@ static noinline void uprobe_func(void) asm volatile (""); } -#define PERF_EVENT_COOKIE 0xdeadbeef - static int verify_perf_link_info(int fd, enum bpf_perf_event_type type, long addr, ssize_t offset, ssize_t entry_offset) { @@ -63,8 +61,6 @@ static int verify_perf_link_info(int fd, enum bpf_perf_event_type type, long add ASSERT_EQ(info.perf_event.kprobe.addr, addr + entry_offset, "kprobe_addr"); - ASSERT_EQ(info.perf_event.kprobe.cookie, PERF_EVENT_COOKIE, "kprobe_cookie"); - if (!info.perf_event.kprobe.func_name) { ASSERT_EQ(info.perf_event.kprobe.name_len, 0, "name_len"); info.perf_event.kprobe.func_name = ptr_to_u64(&buf); @@ -84,8 +80,6 @@ static int verify_perf_link_info(int fd, enum bpf_perf_event_type type, long add goto again; } - ASSERT_EQ(info.perf_event.tracepoint.cookie, PERF_EVENT_COOKIE, "tracepoint_cookie"); - err = strncmp(u64_to_ptr(info.perf_event.tracepoint.tp_name), TP_NAME, strlen(TP_NAME)); ASSERT_EQ(err, 0, "cmp_tp_name"); @@ -101,8 +95,6 @@ static int verify_perf_link_info(int fd, enum bpf_perf_event_type type, long add goto again; } - ASSERT_EQ(info.perf_event.uprobe.cookie, PERF_EVENT_COOKIE, "uprobe_cookie"); - err = strncmp(u64_to_ptr(info.perf_event.uprobe.file_name), UPROBE_FILE, strlen(UPROBE_FILE)); ASSERT_EQ(err, 0, "cmp_file_name"); @@ -146,7 +138,6 @@ static void test_kprobe_fill_link_info(struct test_fill_link_info *skel, DECLARE_LIBBPF_OPTS(bpf_kprobe_opts, opts, .attach_mode = PROBE_ATTACH_MODE_LINK, .retprobe = type == BPF_PERF_EVENT_KRETPROBE, - .bpf_cookie = PERF_EVENT_COOKIE, ); ssize_t entry_offset = 0; struct bpf_link *link; @@ -175,13 +166,10 @@ static void test_kprobe_fill_link_info(struct test_fill_link_info *skel, static void test_tp_fill_link_info(struct test_fill_link_info *skel) { - DECLARE_LIBBPF_OPTS(bpf_tracepoint_opts, opts, - .bpf_cookie = PERF_EVENT_COOKIE, - ); struct bpf_link *link; int link_fd, err; - link = bpf_program__attach_tracepoint_opts(skel->progs.tp_run, TP_CAT, TP_NAME, &opts); + link = bpf_program__attach_tracepoint(skel->progs.tp_run, TP_CAT, TP_NAME); if (!ASSERT_OK_PTR(link, "attach_tp")) return; @@ -194,17 +182,13 @@ static void test_tp_fill_link_info(struct test_fill_link_info *skel) static void test_uprobe_fill_link_info(struct test_fill_link_info *skel, enum bpf_perf_event_type type) { - DECLARE_LIBBPF_OPTS(bpf_uprobe_opts, opts, - .retprobe = type == BPF_PERF_EVENT_URETPROBE, - .bpf_cookie = PERF_EVENT_COOKIE, - ); struct bpf_link *link; int link_fd, err; - link = bpf_program__attach_uprobe_opts(skel->progs.uprobe_run, - 0, /* self pid */ - UPROBE_FILE, uprobe_offset, - &opts); + link = bpf_program__attach_uprobe(skel->progs.uprobe_run, + type == BPF_PERF_EVENT_URETPROBE, + 0, /* self pid */ + UPROBE_FILE, uprobe_offset); if (!ASSERT_OK_PTR(link, "attach_uprobe")) return; -- 2.34.1