lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQ+T-e30wQMfFGp+crgOs1TzYA=c3anRu7k424x8owAXYQ@mail.gmail.com>
Date: Sun, 29 Sep 2024 10:17:51 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Puranjay Mohan <puranjay@...nel.org>
Cc: Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, 
	Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>, 
	Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>, 
	Yonghong Song <yonghong.song@...ux.dev>, John Fastabend <john.fastabend@...il.com>, 
	KP Singh <kpsingh@...nel.org>, bpf <bpf@...r.kernel.org>, 
	LKML <linux-kernel@...r.kernel.org>, Puranjay Mohan <puranjay12@...il.com>
Subject: Re: [PATCH bpf-next v2 2/2] selftests/bpf: Augment send_signal test
 with remote signaling

On Thu, Sep 26, 2024 at 4:54 AM Puranjay Mohan <puranjay@...nel.org> 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@...nel.org>
> ---
>  .../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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ