Re: [PATCH bpf-next v3 2/2] selftests/bpf: Augment send_signal test with remote signaling

From: Puranjay Mohan
Date: Mon Oct 07 2024 - 08:12:06 EST


Puranjay Mohan <puranjay@xxxxxxxxxx> writes:

> Add testcases to test bpf_send_signal_task(). In these new test cases,
> the main process triggers the BPF program and the forked process
> receives the signals. The target process's signal handler receives a
> cookie from the bpf program.
>
> Signed-off-by: Puranjay Mohan <puranjay@xxxxxxxxxx>
> ---
> .../selftests/bpf/prog_tests/send_signal.c | 133 +++++++++++++-----
> .../bpf/progs/test_send_signal_kern.c | 35 ++++-
> 2 files changed, 130 insertions(+), 38 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/send_signal.c b/tools/testing/selftests/bpf/prog_tests/send_signal.c
> index 6cc69900b3106..beb771347a503 100644
> --- a/tools/testing/selftests/bpf/prog_tests/send_signal.c
> +++ b/tools/testing/selftests/bpf/prog_tests/send_signal.c
> @@ -8,17 +8,25 @@ static int sigusr1_received;
>
> static void sigusr1_handler(int signum)
> {
> - sigusr1_received = 1;
> + sigusr1_received = 8;
> +}
> +
> +static void sigusr1_siginfo_handler(int s, siginfo_t *i, void *v)
> +{
> + sigusr1_received = i->si_value.sival_int;

This is incorrect for big-endian archs and I will change this to:

sigusr1_received = (int)(long long)i->si_value.sival_ptr;

This should work on all archs.

> }
>
> static void test_send_signal_common(struct perf_event_attr *attr,
> - bool signal_thread)
> + bool signal_thread, bool remote)

[...]

Thanks,
Puranjay

Attachment: signature.asc
Description: PGP signature