All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
	martin.lau@kernel.org, kernel-team@meta.com
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: validate nulled-out struct_ops program is handled properly
Date: Mon, 29 Apr 2024 14:29:31 -0700	[thread overview]
Message-ID: <5b3e2db0-1582-4f35-9cee-069de799aa41@linux.dev> (raw)
In-Reply-To: <20240428030954.3918764-2-andrii@kernel.org>

On 4/27/24 8:09 PM, Andrii Nakryiko wrote:
> Add a selftests validating that it's possible to have some struct_ops
> callback set declaratively, then disable it (by setting to NULL)
> programmatically. Libbpf should detect that such program should be

such program should be /not/ loaded ?

> loaded, even if host kernel doesn't have type information for it.
> 

> @@ -103,6 +104,10 @@ static void test_struct_ops_not_zeroed(void)
>   	if (!ASSERT_OK_PTR(skel, "struct_ops_module_open"))
>   		return;
>   
> +	skel->struct_ops.testmod_zeroed->zeroed = 0;
> +	/* zeroed_op prog should be not loaded automatically now */
> +	skel->struct_ops.testmod_zeroed->zeroed_op = NULL;
> +
>   	err = struct_ops_module__load(skel);
>   	ASSERT_OK(err, "struct_ops_module_load");
>   
> @@ -118,6 +123,7 @@ static void test_struct_ops_not_zeroed(void)
>   	 * value of "zeroed" is non-zero.
>   	 */
>   	skel->struct_ops.testmod_zeroed->zeroed = 0xdeadbeef;
> +	skel->struct_ops.testmod_zeroed->zeroed_op = NULL;
>   	err = struct_ops_module__load(skel);
>   	ASSERT_ERR(err, "struct_ops_module_load_not_zeroed");
>   


  reply	other threads:[~2024-04-29 21:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-28  3:09 [PATCH bpf-next 1/2] libbpf: handle nulled-out program in struct_ops correctly Andrii Nakryiko
2024-04-28  3:09 ` [PATCH bpf-next 2/2] selftests/bpf: validate nulled-out struct_ops program is handled properly Andrii Nakryiko
2024-04-29 21:29   ` Martin KaFai Lau [this message]
2024-04-29 22:35     ` Andrii Nakryiko
2024-04-29 23:46       ` Martin KaFai Lau
2024-04-30  0:00 ` [PATCH bpf-next 1/2] libbpf: handle nulled-out program in struct_ops correctly patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5b3e2db0-1582-4f35-9cee-069de799aa41@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@meta.com \
    --cc=martin.lau@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.