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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 26, 2024 at 4:54 AM Puranjay Mohan <puranjay@xxxxxxxxxx> wrote:
>
> Add testcases to test bpf_send_signal_remote(). 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;

If I'm reading this correctly:
typedef union sigval {
        int sival_int;
        void *sival_ptr;
} sigval_t;

the user space will receive 4 bytes of garbage if it reads sival_ptr instead.

I think it's better to make sure bpf prog passes 8 bytes instead of 4.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux