Re: [PATCH bpf-next v4 2/4] bpf: Improve error reporting for freplace attachment failure

Alexei Starovoitov
2025-02-24T19:41:32Z

On Mon, Feb 24, 2025 at 7:34 AM Leon Hwang <leon.hwang@linux.dev> wrote:
>
> @@ -3539,7 +3540,7 @@ static int bpf_tracing_prog_attach(struct bpf_prog *prog,
> */
> struct bpf_attach_target_info tgt_info = {};
>
> - err = bpf_check_attach_target(NULL, prog, tgt_prog, btf_id,
> + err = bpf_check_attach_target(log, prog, tgt_prog, btf_id,
> &tgt_info);

I still don't like this uapi addition.

It only helps a rare corner case of freplace usage:
/* If there is no saved target, or the specified target is
* different from the destination specified at load time, we
* need a new trampoline and a check for compatibility
*/

If it was useful in more than one case we could consider it,
but uapi addition for a single rare use, is imo wrong trade off.

pw-bot: cr