On Tue, Mar 17, 2026 at 11:20:59AM +0800, Leon Hwang wrote:

SNIP

> > +static void test_rollback_unlink(void)
> > +{
> > +   LIBBPF_OPTS(bpf_tracing_multi_opts, opts);
> > +   struct tracing_multi_rollback **fillers;
> > +   struct tracing_multi_rollback *skel;
> > +   size_t cnt = FUNCS_CNT;
> > +   __u32 *ids = NULL;
> > +   int err, max;
> > +
> > +   max = get_bpf_max_tramp_links();
> > +   if (!ASSERT_GE(max, 1, "bpf_max_tramp_links"))
> > +           return;
> > +
> > +   /* Attach maximum allowed programs to bpf_fentry_test10 */
> > +   fillers = fillers_load_and_link(max);
> > +   if (!ASSERT_OK_PTR(fillers, "fillers_load_and_link"))
> > +           return;
> > +
> > +   skel = tracing_multi_rollback__open();
> > +   if (!ASSERT_OK_PTR(skel, "tracing_multi_rollback__open"))
> > +           goto cleanup;
> > +
> > +   bpf_program__set_autoload(skel->progs.test_fentry, true);
> > +   bpf_program__set_autoload(skel->progs.test_fexit, true);
> > +
> > +   /*
> > +    * Attach tracing_multi link on bpf_fentry_test1-10, which will
> > +    * fail on bpf_fentry_test10 function, because it already has
> > +    * maximum allowed programs attached.
> > +    *
> > +    * The rollback needs to unlink already link-ed trampolines and
> > +    * put all of them.
> > +    */
> > +   err = tracing_multi_rollback__load(skel);
> > +   if (!ASSERT_OK(err, "tracing_multi_rollback__load"))
> > +           goto cleanup;
> > +
> > +   ids = get_ids(bpf_fentry_test, cnt, NULL);
> > +   if (!ASSERT_OK_PTR(ids, "get_ids"))
> > +           goto cleanup;
> > +
> > +   opts.ids = ids;
> > +   opts.cnt = cnt;
> > +
> > +   skel->bss->pid = getpid();
> > +
> > +   skel->links.test_fentry = 
> > bpf_program__attach_tracing_multi(skel->progs.test_fentry,
> > +                                           NULL, &opts);
> > +   if (!ASSERT_ERR_PTR(skel->links.test_fentry, 
> > "bpf_program__attach_tracing_multi"))
> > +           goto cleanup;
> > +
> > +   skel->links.test_fexit = 
> > bpf_program__attach_tracing_multi(skel->progs.test_fexit,
> > +                                           NULL, &opts);
> > +   if (!ASSERT_ERR_PTR(skel->links.test_fexit, 
> > "bpf_program__attach_tracing_multi"))
> > +           goto cleanup;
> > +
> > +   tracing_multi_rollback_run(skel);
> > +
> > +cleanup:
>       tracing_multi_rollback__destroy(skel); is missed to destroy skel?

it is, will add, thanks

jirka

Reply via email to