On Fri, 2026-06-19 at 07:59 +0000, Yiyang Chen wrote:

[...]

> diff --git a/tools/testing/selftests/bpf/progs/refcounted_kptr.c 
> b/tools/testing/selftests/bpf/progs/refcounted_kptr.c
> index 61906f480..7955a9973 100644
> --- a/tools/testing/selftests/bpf/progs/refcounted_kptr.c
> +++ b/tools/testing/selftests/bpf/progs/refcounted_kptr.c
> @@ -741,6 +741,39 @@ int list_push_back_uninit_head(void *ctx)
>       return ret;
>  }
>  
> +SEC("tc")
> +__description("refcount_acquire_list_pop_container: acquire normalized list 
> pop")
> +__success __retval(0)
> +int refcount_acquire_list_pop_container(void *ctx)
> +{
> +     struct node_data *node, *base, *ref;
> +     struct bpf_list_node *list_node;
> +     long err;
> +
> +     node = bpf_obj_new(typeof(*node));
> +     if (!node)
> +             return -1;
> +
> +     bpf_spin_lock(&lock);
> +     err = bpf_list_push_front(&head, &node->l);
> +     if (err) {
> +             bpf_spin_unlock(&lock);
> +             bpf_obj_drop(node);
> +             return -2;
> +     }
> +
> +     list_node = bpf_list_pop_front(&head);
> +     bpf_spin_unlock(&lock);
> +     if (!list_node)
> +             return -3;
> +
> +     base = container_of(list_node, struct node_data, l);
> +     ref = bpf_refcount_acquire(base);
> +     bpf_obj_drop(ref);
> +     bpf_obj_drop(base);
> +     return 0;
> +}
> +

Why do you think the positive test case is necessary?

[...]

Reply via email to