|
3 | 3 | #include "test_attach_kprobe_sleepable.skel.h" |
4 | 4 | #include "test_attach_probe_manual.skel.h" |
5 | 5 | #include "test_attach_probe.skel.h" |
| 6 | +#include "kprobe_write_ctx.skel.h" |
6 | 7 |
|
7 | 8 | /* this is how USDT semaphore is actually defined, except volatile modifier */ |
8 | 9 | volatile unsigned short uprobe_ref_ctr __attribute__((unused)) __attribute((section(".probes"))); |
@@ -201,6 +202,31 @@ static void test_attach_kprobe_long_event_name(void) |
201 | 202 | test_attach_probe_manual__destroy(skel); |
202 | 203 | } |
203 | 204 |
|
| 205 | +#ifdef __x86_64__ |
| 206 | +/* attach kprobe/kretprobe long event name testings */ |
| 207 | +static void test_attach_kprobe_write_ctx(void) |
| 208 | +{ |
| 209 | + struct kprobe_write_ctx *skel = NULL; |
| 210 | + struct bpf_link *link = NULL; |
| 211 | + |
| 212 | + skel = kprobe_write_ctx__open_and_load(); |
| 213 | + if (!ASSERT_OK_PTR(skel, "kprobe_write_ctx__open_and_load")) |
| 214 | + return; |
| 215 | + |
| 216 | + link = bpf_program__attach_kprobe_opts(skel->progs.kprobe_write_ctx, |
| 217 | + "bpf_fentry_test1", NULL); |
| 218 | + if (!ASSERT_ERR_PTR(link, "bpf_program__attach_kprobe_opts")) |
| 219 | + bpf_link__destroy(link); |
| 220 | + |
| 221 | + kprobe_write_ctx__destroy(skel); |
| 222 | +} |
| 223 | +#else |
| 224 | +static void test_attach_kprobe_write_ctx(void) |
| 225 | +{ |
| 226 | + test__skip(); |
| 227 | +} |
| 228 | +#endif |
| 229 | + |
204 | 230 | static void test_attach_probe_auto(struct test_attach_probe *skel) |
205 | 231 | { |
206 | 232 | struct bpf_link *uprobe_err_link; |
@@ -406,6 +432,8 @@ void test_attach_probe(void) |
406 | 432 | test_attach_uprobe_long_event_name(); |
407 | 433 | if (test__start_subtest("kprobe-long_name")) |
408 | 434 | test_attach_kprobe_long_event_name(); |
| 435 | + if (test__start_subtest("kprobe-write-ctx")) |
| 436 | + test_attach_kprobe_write_ctx(); |
409 | 437 |
|
410 | 438 | cleanup: |
411 | 439 | test_attach_probe__destroy(skel); |
|
0 commit comments