Re: [PATCH bpf-next 2/2] selftests/bpf: Add uprobe pid filter test for multiple processes
From: Andrii Nakryiko
Date: Fri Aug 30 2024 - 16:51:24 EST
On Thu, Aug 29, 2024 at 12:45 PM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
>
> The idea is to create and monitor 3 uprobes, each trigered in separate
typo: triggered
> process and make sure the bpf program gets executed just for the proper
> PID specified via pid filter.
>
> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> ---
> .../bpf/prog_tests/uprobe_multi_test.c | 103 ++++++++++++++++++
> .../bpf/progs/uprobe_multi_pid_filter.c | 61 +++++++++++
> 2 files changed, 164 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_pid_filter.c
>
It's good to have a test, thanks for adding it! But we should couple
it with the fix in multi-uprobe and land together, right? I'm not
exactly sure why we can't just use task->signal-based check, but let's
try to converge on something and fix it.
pw-bot: cr
[...]
> +#define TASKS 3
> +
> +static void run_pid_filter(struct uprobe_multi_pid_filter *skel,
> + create_link_t create_link, bool retprobe)
> +{
> + struct bpf_link *link[TASKS] = {};
> + struct child child[TASKS] = {};
> + int i;
> +
> + printf("%s retprobe %d\n", create_link == create_link_uprobe ? "uprobe" : "uprobe_multi",
> + retprobe);
leftovers
> +
> + memset(skel->bss->test, 0, sizeof(skel->bss->test));
> +
> + for (i = 0; i < TASKS; i++) {
> + if (!ASSERT_OK(spawn_child(&child[i]), "spawn_child"))
> + goto cleanup;
> + skel->bss->pids[i] = child[i].pid;
> + }
[...]