BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v1] selftests/bpf: Refactor cb_refs selftests
@ 2026-09-23 23:07 Ihor Solodrai
  2026-09-23 23:18 ` Amery Hung
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ihor Solodrai @ 2026-09-23 23:07 UTC (permalink / raw)
  To: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Eduard Zingerman, Kumar Kartikeya Dwivedi
  Cc: bpf, Mark Brown

cb_refs matches verifier messages such as "Unreleased reference id=4
alloc_insn=3". The ID is allocated from env->id_gen, so it changes
whenever the verifier assigns another ID earlier in the program.

In the bpf tree commit 71919742c83c ("bpf: Assign lock identity to
callback map values") gives each callback map value an ID, and the
nested_cb expectation was changed to id=5.

In the bpf-next tree, commit 5dc1549afac9 ("bpf: Consolidate release
argument validation") changed leak_prog to expect id=4 from the same
leak check.

The trees are merged in linux-next, and there leak_prog reports id=5
and the test fails [1]:

  Expected: Unreleased reference id=4 alloc_insn=3
  ...
  Unreleased reference id=5 alloc_insn=33

The ID is incidental. The test checks that the verifier rejects the
leak and which acquisition leaked.

Convert the test to test_loader, register the test in
prog_tests/verifier.c and drop unnecessary prog_tests/cb_refs.c file.

[1] https://github.com/kernel-patches/bpf/actions/runs/35923662147/job/107398076527

Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
---
 .../selftests/bpf/prog_tests/cb_refs.c        | 48 -------------------
 .../selftests/bpf/prog_tests/verifier.c       |  3 ++
 tools/testing/selftests/bpf/progs/cb_refs.c   |  5 ++
 3 files changed, 8 insertions(+), 48 deletions(-)
 delete mode 100644 tools/testing/selftests/bpf/prog_tests/cb_refs.c

diff --git a/tools/testing/selftests/bpf/prog_tests/cb_refs.c b/tools/testing/selftests/bpf/prog_tests/cb_refs.c
deleted file mode 100644
index c32c6dab49bc..000000000000
--- a/tools/testing/selftests/bpf/prog_tests/cb_refs.c
+++ /dev/null
@@ -1,48 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include "bpf/libbpf.h"
-#include <test_progs.h>
-#include <network_helpers.h>
-
-#include "cb_refs.skel.h"
-
-static char log_buf[1024 * 1024];
-
-struct {
-	const char *prog_name;
-	const char *err_msg;
-} cb_refs_tests[] = {
-	{ "underflow_prog", "R1 type=scalar expected=ptr_, trusted_ptr_, rcu_ptr_" },
-	{ "leak_prog", "Unreleased reference id=4 alloc_insn=3" }, /* alloc_insn=3{2,3} */
-	{ "nested_cb", "Unreleased reference id=4 alloc_insn=2" }, /* alloc_insn=2{4,5} */
-	{ "non_cb_transfer_ref", "Unreleased reference id=4 alloc_insn=1" }, /* alloc_insn=1{1,2} */
-};
-
-void test_cb_refs(void)
-{
-	LIBBPF_OPTS(bpf_object_open_opts, opts, .kernel_log_buf = log_buf,
-						.kernel_log_size = sizeof(log_buf),
-						.kernel_log_level = 1);
-	struct bpf_program *prog;
-	struct cb_refs *skel;
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(cb_refs_tests); i++) {
-		LIBBPF_OPTS(bpf_test_run_opts, run_opts,
-			.data_in = &pkt_v4,
-			.data_size_in = sizeof(pkt_v4),
-			.repeat = 1,
-		);
-		skel = cb_refs__open_opts(&opts);
-		if (!ASSERT_OK_PTR(skel, "cb_refs__open_and_load"))
-			return;
-		prog = bpf_object__find_program_by_name(skel->obj, cb_refs_tests[i].prog_name);
-		bpf_program__set_autoload(prog, true);
-		if (!ASSERT_ERR(cb_refs__load(skel), "cb_refs__load"))
-			bpf_prog_test_run_opts(bpf_program__fd(prog), &run_opts);
-		if (!ASSERT_OK_PTR(strstr(log_buf, cb_refs_tests[i].err_msg), "expected error message")) {
-			fprintf(stderr, "Expected: %s\n", cb_refs_tests[i].err_msg);
-			fprintf(stderr, "Verifier: %s\n", log_buf);
-		}
-		cb_refs__destroy(skel);
-	}
-}
diff --git a/tools/testing/selftests/bpf/prog_tests/verifier.c b/tools/testing/selftests/bpf/prog_tests/verifier.c
index 4f1e1c1cd5ab..8b4be06bb181 100644
--- a/tools/testing/selftests/bpf/prog_tests/verifier.c
+++ b/tools/testing/selftests/bpf/prog_tests/verifier.c
@@ -5,6 +5,7 @@
 #include "arena_kfunc.skel.h"
 #include "arena_kfunc_jit.skel.h"
 #include "cap_helpers.h"
+#include "cb_refs.skel.h"
 #include "verifier_aggregate_arg.skel.h"
 #include "verifier_aggregate_ret.skel.h"
 #include "verifier_align.skel.h"
@@ -176,6 +177,8 @@ void test_arena_kfunc(void)                   { RUN_TESTS(arena_kfunc); }
 
 void test_arena_kfunc_jit(void)               { RUN_TESTS(arena_kfunc_jit); }
 
+void test_cb_refs(void)                       { RUN_TESTS(cb_refs); }
+
 void test_verifier_aggregate_arg(void)        { RUN_TESTS(verifier_aggregate_arg); }
 void test_verifier_aggregate_ret(void)        { RUN_TESTS(verifier_aggregate_ret); }
 void test_verifier_align(void)                { RUN(verifier_align); }
diff --git a/tools/testing/selftests/bpf/progs/cb_refs.c b/tools/testing/selftests/bpf/progs/cb_refs.c
index 5d6fc7f01ebb..d4a691db8a15 100644
--- a/tools/testing/selftests/bpf/progs/cb_refs.c
+++ b/tools/testing/selftests/bpf/progs/cb_refs.c
@@ -2,6 +2,7 @@
 #include <vmlinux.h>
 #include <bpf/bpf_tracing.h>
 #include <bpf/bpf_helpers.h>
+#include "bpf_misc.h"
 #include "../test_kmods/bpf_testmod_kfunc.h"
 
 struct map_value {
@@ -24,6 +25,7 @@ static __noinline int cb1(void *map, void *key, void *value, void *ctx)
 }
 
 SEC("?tc")
+__failure __msg("R1 type=scalar expected=ptr_, trusted_ptr_, rcu_ptr_")
 int underflow_prog(void *ctx)
 {
 	struct prog_test_ref_kfunc *p;
@@ -47,6 +49,7 @@ static __always_inline int cb2(void *map, void *key, void *value, void *ctx)
 }
 
 SEC("?tc")
+__failure __msg("Unreleased reference id={{[0-9]+}} alloc_insn=3") /* alloc_insn=3{0,2,3} */
 int leak_prog(void *ctx)
 {
 	struct prog_test_ref_kfunc *p;
@@ -83,6 +86,7 @@ static __always_inline int cb3(void *map, void *key, void *value, void *ctx)
 }
 
 SEC("?tc")
+__failure __msg("Unreleased reference id={{[0-9]+}} alloc_insn=2") /* alloc_insn=2{2,4,5} */
 int nested_cb(void *ctx)
 {
 	struct prog_test_ref_kfunc *p;
@@ -98,6 +102,7 @@ int nested_cb(void *ctx)
 }
 
 SEC("?tc")
+__failure __msg("Unreleased reference id={{[0-9]+}} alloc_insn=1") /* alloc_insn=1{1,2} */
 int non_cb_transfer_ref(void *ctx)
 {
 	struct prog_test_ref_kfunc *p;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next v1] selftests/bpf: Refactor cb_refs selftests
  2026-09-23 23:07 [PATCH bpf-next v1] selftests/bpf: Refactor cb_refs selftests Ihor Solodrai
@ 2026-09-23 23:18 ` Amery Hung
  2026-09-24  0:26 ` Emil Tsalapatis
  2026-09-24  1:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Amery Hung @ 2026-09-23 23:18 UTC (permalink / raw)
  To: Ihor Solodrai
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, bpf, Mark Brown

On Wed, Sep 23, 2026 at 4:07 PM Ihor Solodrai <ihor.solodrai@linux.dev> wrote:
>
> cb_refs matches verifier messages such as "Unreleased reference id=4
> alloc_insn=3". The ID is allocated from env->id_gen, so it changes
> whenever the verifier assigns another ID earlier in the program.
>
> In the bpf tree commit 71919742c83c ("bpf: Assign lock identity to
> callback map values") gives each callback map value an ID, and the
> nested_cb expectation was changed to id=5.
>
> In the bpf-next tree, commit 5dc1549afac9 ("bpf: Consolidate release
> argument validation") changed leak_prog to expect id=4 from the same
> leak check.
>
> The trees are merged in linux-next, and there leak_prog reports id=5
> and the test fails [1]:
>
>   Expected: Unreleased reference id=4 alloc_insn=3
>   ...
>   Unreleased reference id=5 alloc_insn=33
>
> The ID is incidental. The test checks that the verifier rejects the
> leak and which acquisition leaked.
>
> Convert the test to test_loader, register the test in
> prog_tests/verifier.c and drop unnecessary prog_tests/cb_refs.c file.
>
> [1] https://github.com/kernel-patches/bpf/actions/runs/35923662147/job/107398076527
>
> Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>

Reviewed-by: Amery Hung <ameryhung@gmail.com>

> ---
>  .../selftests/bpf/prog_tests/cb_refs.c        | 48 -------------------
>  .../selftests/bpf/prog_tests/verifier.c       |  3 ++
>  tools/testing/selftests/bpf/progs/cb_refs.c   |  5 ++
>  3 files changed, 8 insertions(+), 48 deletions(-)
>  delete mode 100644 tools/testing/selftests/bpf/prog_tests/cb_refs.c
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/cb_refs.c b/tools/testing/selftests/bpf/prog_tests/cb_refs.c
> deleted file mode 100644
> index c32c6dab49bc..000000000000
> --- a/tools/testing/selftests/bpf/prog_tests/cb_refs.c
> +++ /dev/null
> @@ -1,48 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -#include "bpf/libbpf.h"
> -#include <test_progs.h>
> -#include <network_helpers.h>
> -
> -#include "cb_refs.skel.h"
> -
> -static char log_buf[1024 * 1024];
> -
> -struct {
> -       const char *prog_name;
> -       const char *err_msg;
> -} cb_refs_tests[] = {
> -       { "underflow_prog", "R1 type=scalar expected=ptr_, trusted_ptr_, rcu_ptr_" },
> -       { "leak_prog", "Unreleased reference id=4 alloc_insn=3" }, /* alloc_insn=3{2,3} */
> -       { "nested_cb", "Unreleased reference id=4 alloc_insn=2" }, /* alloc_insn=2{4,5} */
> -       { "non_cb_transfer_ref", "Unreleased reference id=4 alloc_insn=1" }, /* alloc_insn=1{1,2} */
> -};
> -
> -void test_cb_refs(void)
> -{
> -       LIBBPF_OPTS(bpf_object_open_opts, opts, .kernel_log_buf = log_buf,
> -                                               .kernel_log_size = sizeof(log_buf),
> -                                               .kernel_log_level = 1);
> -       struct bpf_program *prog;
> -       struct cb_refs *skel;
> -       int i;
> -
> -       for (i = 0; i < ARRAY_SIZE(cb_refs_tests); i++) {
> -               LIBBPF_OPTS(bpf_test_run_opts, run_opts,
> -                       .data_in = &pkt_v4,
> -                       .data_size_in = sizeof(pkt_v4),
> -                       .repeat = 1,
> -               );
> -               skel = cb_refs__open_opts(&opts);
> -               if (!ASSERT_OK_PTR(skel, "cb_refs__open_and_load"))
> -                       return;
> -               prog = bpf_object__find_program_by_name(skel->obj, cb_refs_tests[i].prog_name);
> -               bpf_program__set_autoload(prog, true);
> -               if (!ASSERT_ERR(cb_refs__load(skel), "cb_refs__load"))
> -                       bpf_prog_test_run_opts(bpf_program__fd(prog), &run_opts);
> -               if (!ASSERT_OK_PTR(strstr(log_buf, cb_refs_tests[i].err_msg), "expected error message")) {
> -                       fprintf(stderr, "Expected: %s\n", cb_refs_tests[i].err_msg);
> -                       fprintf(stderr, "Verifier: %s\n", log_buf);
> -               }
> -               cb_refs__destroy(skel);
> -       }
> -}
> diff --git a/tools/testing/selftests/bpf/prog_tests/verifier.c b/tools/testing/selftests/bpf/prog_tests/verifier.c
> index 4f1e1c1cd5ab..8b4be06bb181 100644
> --- a/tools/testing/selftests/bpf/prog_tests/verifier.c
> +++ b/tools/testing/selftests/bpf/prog_tests/verifier.c
> @@ -5,6 +5,7 @@
>  #include "arena_kfunc.skel.h"
>  #include "arena_kfunc_jit.skel.h"
>  #include "cap_helpers.h"
> +#include "cb_refs.skel.h"
>  #include "verifier_aggregate_arg.skel.h"
>  #include "verifier_aggregate_ret.skel.h"
>  #include "verifier_align.skel.h"
> @@ -176,6 +177,8 @@ void test_arena_kfunc(void)                   { RUN_TESTS(arena_kfunc); }
>
>  void test_arena_kfunc_jit(void)               { RUN_TESTS(arena_kfunc_jit); }
>
> +void test_cb_refs(void)                       { RUN_TESTS(cb_refs); }
> +
>  void test_verifier_aggregate_arg(void)        { RUN_TESTS(verifier_aggregate_arg); }
>  void test_verifier_aggregate_ret(void)        { RUN_TESTS(verifier_aggregate_ret); }
>  void test_verifier_align(void)                { RUN(verifier_align); }
> diff --git a/tools/testing/selftests/bpf/progs/cb_refs.c b/tools/testing/selftests/bpf/progs/cb_refs.c
> index 5d6fc7f01ebb..d4a691db8a15 100644
> --- a/tools/testing/selftests/bpf/progs/cb_refs.c
> +++ b/tools/testing/selftests/bpf/progs/cb_refs.c
> @@ -2,6 +2,7 @@
>  #include <vmlinux.h>
>  #include <bpf/bpf_tracing.h>
>  #include <bpf/bpf_helpers.h>
> +#include "bpf_misc.h"
>  #include "../test_kmods/bpf_testmod_kfunc.h"
>
>  struct map_value {
> @@ -24,6 +25,7 @@ static __noinline int cb1(void *map, void *key, void *value, void *ctx)
>  }
>
>  SEC("?tc")
> +__failure __msg("R1 type=scalar expected=ptr_, trusted_ptr_, rcu_ptr_")
>  int underflow_prog(void *ctx)
>  {
>         struct prog_test_ref_kfunc *p;
> @@ -47,6 +49,7 @@ static __always_inline int cb2(void *map, void *key, void *value, void *ctx)
>  }
>
>  SEC("?tc")
> +__failure __msg("Unreleased reference id={{[0-9]+}} alloc_insn=3") /* alloc_insn=3{0,2,3} */
>  int leak_prog(void *ctx)
>  {
>         struct prog_test_ref_kfunc *p;
> @@ -83,6 +86,7 @@ static __always_inline int cb3(void *map, void *key, void *value, void *ctx)
>  }
>
>  SEC("?tc")
> +__failure __msg("Unreleased reference id={{[0-9]+}} alloc_insn=2") /* alloc_insn=2{2,4,5} */
>  int nested_cb(void *ctx)
>  {
>         struct prog_test_ref_kfunc *p;
> @@ -98,6 +102,7 @@ int nested_cb(void *ctx)
>  }
>
>  SEC("?tc")
> +__failure __msg("Unreleased reference id={{[0-9]+}} alloc_insn=1") /* alloc_insn=1{1,2} */
>  int non_cb_transfer_ref(void *ctx)
>  {
>         struct prog_test_ref_kfunc *p;
> --
> 2.55.0
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next v1] selftests/bpf: Refactor cb_refs selftests
  2026-09-23 23:07 [PATCH bpf-next v1] selftests/bpf: Refactor cb_refs selftests Ihor Solodrai
  2026-09-23 23:18 ` Amery Hung
@ 2026-09-24  0:26 ` Emil Tsalapatis
  2026-09-24  1:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Emil Tsalapatis @ 2026-09-24  0:26 UTC (permalink / raw)
  To: Ihor Solodrai, Alexei Starovoitov, Andrii Nakryiko,
	Daniel Borkmann, Eduard Zingerman, Kumar Kartikeya Dwivedi
  Cc: bpf, Mark Brown

On Wed Sep 23, 2026 at 11:07 PM UTC, Ihor Solodrai wrote:
> cb_refs matches verifier messages such as "Unreleased reference id=4
> alloc_insn=3". The ID is allocated from env->id_gen, so it changes
> whenever the verifier assigns another ID earlier in the program.
>
> In the bpf tree commit 71919742c83c ("bpf: Assign lock identity to
> callback map values") gives each callback map value an ID, and the
> nested_cb expectation was changed to id=5.
>
> In the bpf-next tree, commit 5dc1549afac9 ("bpf: Consolidate release
> argument validation") changed leak_prog to expect id=4 from the same
> leak check.
>
> The trees are merged in linux-next, and there leak_prog reports id=5
> and the test fails [1]:
>
>   Expected: Unreleased reference id=4 alloc_insn=3
>   ...
>   Unreleased reference id=5 alloc_insn=33
>
> The ID is incidental. The test checks that the verifier rejects the
> leak and which acquisition leaked.
>
> Convert the test to test_loader, register the test in
> prog_tests/verifier.c and drop unnecessary prog_tests/cb_refs.c file.
>
> [1] https://github.com/kernel-patches/bpf/actions/runs/35923662147/job/107398076527
>
> Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>

Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>

> ---
>  .../selftests/bpf/prog_tests/cb_refs.c        | 48 -------------------
>  .../selftests/bpf/prog_tests/verifier.c       |  3 ++
>  tools/testing/selftests/bpf/progs/cb_refs.c   |  5 ++
>  3 files changed, 8 insertions(+), 48 deletions(-)
>  delete mode 100644 tools/testing/selftests/bpf/prog_tests/cb_refs.c
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/cb_refs.c b/tools/testing/selftests/bpf/prog_tests/cb_refs.c
> deleted file mode 100644
> index c32c6dab49bc..000000000000
> --- a/tools/testing/selftests/bpf/prog_tests/cb_refs.c
> +++ /dev/null
> @@ -1,48 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -#include "bpf/libbpf.h"
> -#include <test_progs.h>
> -#include <network_helpers.h>
> -
> -#include "cb_refs.skel.h"
> -
> -static char log_buf[1024 * 1024];
> -
> -struct {
> -	const char *prog_name;
> -	const char *err_msg;
> -} cb_refs_tests[] = {
> -	{ "underflow_prog", "R1 type=scalar expected=ptr_, trusted_ptr_, rcu_ptr_" },
> -	{ "leak_prog", "Unreleased reference id=4 alloc_insn=3" }, /* alloc_insn=3{2,3} */
> -	{ "nested_cb", "Unreleased reference id=4 alloc_insn=2" }, /* alloc_insn=2{4,5} */
> -	{ "non_cb_transfer_ref", "Unreleased reference id=4 alloc_insn=1" }, /* alloc_insn=1{1,2} */
> -};
> -
> -void test_cb_refs(void)
> -{
> -	LIBBPF_OPTS(bpf_object_open_opts, opts, .kernel_log_buf = log_buf,
> -						.kernel_log_size = sizeof(log_buf),
> -						.kernel_log_level = 1);
> -	struct bpf_program *prog;
> -	struct cb_refs *skel;
> -	int i;
> -
> -	for (i = 0; i < ARRAY_SIZE(cb_refs_tests); i++) {
> -		LIBBPF_OPTS(bpf_test_run_opts, run_opts,
> -			.data_in = &pkt_v4,
> -			.data_size_in = sizeof(pkt_v4),
> -			.repeat = 1,
> -		);
> -		skel = cb_refs__open_opts(&opts);
> -		if (!ASSERT_OK_PTR(skel, "cb_refs__open_and_load"))
> -			return;
> -		prog = bpf_object__find_program_by_name(skel->obj, cb_refs_tests[i].prog_name);
> -		bpf_program__set_autoload(prog, true);
> -		if (!ASSERT_ERR(cb_refs__load(skel), "cb_refs__load"))
> -			bpf_prog_test_run_opts(bpf_program__fd(prog), &run_opts);
> -		if (!ASSERT_OK_PTR(strstr(log_buf, cb_refs_tests[i].err_msg), "expected error message")) {
> -			fprintf(stderr, "Expected: %s\n", cb_refs_tests[i].err_msg);
> -			fprintf(stderr, "Verifier: %s\n", log_buf);
> -		}
> -		cb_refs__destroy(skel);
> -	}
> -}
> diff --git a/tools/testing/selftests/bpf/prog_tests/verifier.c b/tools/testing/selftests/bpf/prog_tests/verifier.c
> index 4f1e1c1cd5ab..8b4be06bb181 100644
> --- a/tools/testing/selftests/bpf/prog_tests/verifier.c
> +++ b/tools/testing/selftests/bpf/prog_tests/verifier.c
> @@ -5,6 +5,7 @@
>  #include "arena_kfunc.skel.h"
>  #include "arena_kfunc_jit.skel.h"
>  #include "cap_helpers.h"
> +#include "cb_refs.skel.h"
>  #include "verifier_aggregate_arg.skel.h"
>  #include "verifier_aggregate_ret.skel.h"
>  #include "verifier_align.skel.h"
> @@ -176,6 +177,8 @@ void test_arena_kfunc(void)                   { RUN_TESTS(arena_kfunc); }
>  
>  void test_arena_kfunc_jit(void)               { RUN_TESTS(arena_kfunc_jit); }
>  
> +void test_cb_refs(void)                       { RUN_TESTS(cb_refs); }
> +
>  void test_verifier_aggregate_arg(void)        { RUN_TESTS(verifier_aggregate_arg); }
>  void test_verifier_aggregate_ret(void)        { RUN_TESTS(verifier_aggregate_ret); }
>  void test_verifier_align(void)                { RUN(verifier_align); }
> diff --git a/tools/testing/selftests/bpf/progs/cb_refs.c b/tools/testing/selftests/bpf/progs/cb_refs.c
> index 5d6fc7f01ebb..d4a691db8a15 100644
> --- a/tools/testing/selftests/bpf/progs/cb_refs.c
> +++ b/tools/testing/selftests/bpf/progs/cb_refs.c
> @@ -2,6 +2,7 @@
>  #include <vmlinux.h>
>  #include <bpf/bpf_tracing.h>
>  #include <bpf/bpf_helpers.h>
> +#include "bpf_misc.h"
>  #include "../test_kmods/bpf_testmod_kfunc.h"
>  
>  struct map_value {
> @@ -24,6 +25,7 @@ static __noinline int cb1(void *map, void *key, void *value, void *ctx)
>  }
>  
>  SEC("?tc")
> +__failure __msg("R1 type=scalar expected=ptr_, trusted_ptr_, rcu_ptr_")
>  int underflow_prog(void *ctx)
>  {
>  	struct prog_test_ref_kfunc *p;
> @@ -47,6 +49,7 @@ static __always_inline int cb2(void *map, void *key, void *value, void *ctx)
>  }
>  
>  SEC("?tc")
> +__failure __msg("Unreleased reference id={{[0-9]+}} alloc_insn=3") /* alloc_insn=3{0,2,3} */
>  int leak_prog(void *ctx)
>  {
>  	struct prog_test_ref_kfunc *p;
> @@ -83,6 +86,7 @@ static __always_inline int cb3(void *map, void *key, void *value, void *ctx)
>  }
>  
>  SEC("?tc")
> +__failure __msg("Unreleased reference id={{[0-9]+}} alloc_insn=2") /* alloc_insn=2{2,4,5} */
>  int nested_cb(void *ctx)
>  {
>  	struct prog_test_ref_kfunc *p;
> @@ -98,6 +102,7 @@ int nested_cb(void *ctx)
>  }
>  
>  SEC("?tc")
> +__failure __msg("Unreleased reference id={{[0-9]+}} alloc_insn=1") /* alloc_insn=1{1,2} */
>  int non_cb_transfer_ref(void *ctx)
>  {
>  	struct prog_test_ref_kfunc *p;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next v1] selftests/bpf: Refactor cb_refs selftests
  2026-09-23 23:07 [PATCH bpf-next v1] selftests/bpf: Refactor cb_refs selftests Ihor Solodrai
  2026-09-23 23:18 ` Amery Hung
  2026-09-24  0:26 ` Emil Tsalapatis
@ 2026-09-24  1:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-24  1:50 UTC (permalink / raw)
  To: Ihor Solodrai; +Cc: ast, andrii, daniel, eddyz87, memxor, bpf, broonie

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed, 23 Sep 2026 16:07:17 -0700 you wrote:
> cb_refs matches verifier messages such as "Unreleased reference id=4
> alloc_insn=3". The ID is allocated from env->id_gen, so it changes
> whenever the verifier assigns another ID earlier in the program.
> 
> In the bpf tree commit 71919742c83c ("bpf: Assign lock identity to
> callback map values") gives each callback map value an ID, and the
> nested_cb expectation was changed to id=5.
> 
> [...]

Here is the summary with links:
  - [bpf-next,v1] selftests/bpf: Refactor cb_refs selftests
    https://git.kernel.org/bpf/bpf-next/c/11300f54bd88

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-24  1:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-23 23:07 [PATCH bpf-next v1] selftests/bpf: Refactor cb_refs selftests Ihor Solodrai
2026-09-23 23:18 ` Amery Hung
2026-09-24  0:26 ` Emil Tsalapatis
2026-09-24  1:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox