Re: [PATCH bpf-next] bpf:syscall: Log error code on trampoline unlink failure

From: xu.xin16

Date: Thu Jul 16 2026 - 01:55:30 EST


> In subject, 'bpf:' is enough, 'syscall:' can be dropped.

Ok, thanks.

>
> On 16/7/26 11:34, xu.xin16@xxxxxxxxxx wrote:
> > From: xu xin <xu.xin16@xxxxxxxxxx>
> >
> > Replace silent WARN_ON_ONCE with WARN_ONCE that prints the actual error
> > code from bpf_trampoline_unlink_prog(). This aids debugging of race
> > conditions during link teardown, while keeping the warning rate limited
> > to avoid log flooding.
>
>
> Have you tried to trace bpf_trampoline_unlink_prog() with fexit?
>
> bpftrace -lv 'fexit:bpf_trampoline_unlink_prog'
> kretfunc:vmlinux:bpf_trampoline_unlink_prog
> struct bpf_tramp_node * node
> struct bpf_trampoline * tr
> struct bpf_prog * tgt_prog
> int retval
>
> Since bpf_trampoline_unlink_prog() can be traced with fexit, it seems
> unnecessary for this change?

Well, the crash may happen when the kernel is booting, or too hard to reproduce,
in which case, bpftrace does not work.

So this change will be more helpful, I believe.

Thanks,
xu xin