|
7 | 7 | #include "kprobe_multi_session.skel.h"
|
8 | 8 | #include "kprobe_multi_session_cookie.skel.h"
|
9 | 9 | #include "kprobe_multi_verifier.skel.h"
|
| 10 | +#include "kprobe_write_ctx.skel.h" |
10 | 11 | #include "bpf/libbpf_internal.h"
|
11 | 12 | #include "bpf/hashmap.h"
|
12 | 13 |
|
@@ -539,6 +540,30 @@ static void test_attach_override(void)
|
539 | 540 | kprobe_multi_override__destroy(skel);
|
540 | 541 | }
|
541 | 542 |
|
| 543 | +#ifdef __x86_64__ |
| 544 | +static void test_attach_write_ctx(void) |
| 545 | +{ |
| 546 | + struct kprobe_write_ctx *skel = NULL; |
| 547 | + struct bpf_link *link = NULL; |
| 548 | + |
| 549 | + skel = kprobe_write_ctx__open_and_load(); |
| 550 | + if (!ASSERT_OK_PTR(skel, "kprobe_write_ctx__open_and_load")) |
| 551 | + return; |
| 552 | + |
| 553 | + link = bpf_program__attach_kprobe_opts(skel->progs.kprobe_multi_write_ctx, |
| 554 | + "bpf_fentry_test1", NULL); |
| 555 | + if (!ASSERT_ERR_PTR(link, "bpf_program__attach_kprobe_opts")) |
| 556 | + bpf_link__destroy(link); |
| 557 | + |
| 558 | + kprobe_write_ctx__destroy(skel); |
| 559 | +} |
| 560 | +#else |
| 561 | +static void test_attach_write_ctx(void) |
| 562 | +{ |
| 563 | + test__skip(); |
| 564 | +} |
| 565 | +#endif |
| 566 | + |
542 | 567 | void serial_test_kprobe_multi_bench_attach(void)
|
543 | 568 | {
|
544 | 569 | if (test__start_subtest("kernel"))
|
@@ -578,5 +603,7 @@ void test_kprobe_multi_test(void)
|
578 | 603 | test_session_cookie_skel_api();
|
579 | 604 | if (test__start_subtest("unique_match"))
|
580 | 605 | test_unique_match();
|
| 606 | + if (test__start_subtest("attach_write_ctx")) |
| 607 | + test_attach_write_ctx(); |
581 | 608 | RUN_TESTS(kprobe_multi_verifier);
|
582 | 609 | }
|
0 commit comments