BPF List
 help / color / mirror / Atom feed
From: Leon Hwang <leon.hwang@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Song Liu <song@kernel.org>, Eddy Z <eddyz87@gmail.com>,
	Manjusaka <me@manjusaka.me>,
	kernel-patches-bot@fb.com
Subject: Re: [PATCH bpf-next v3 2/4] bpf: Improve error reporting for freplace attachment failure
Date: Tue, 18 Feb 2025 11:29:50 +0800	[thread overview]
Message-ID: <a49fb92c-417f-4966-8a09-89a6cf448d6b@linux.dev> (raw)
In-Reply-To: <CAADnVQJ3XHgTVVT9=wtNtCNaERpiYnL-c9=kDART_9cejwBSqw@mail.gmail.com>



On 18/2/25 11:01, Alexei Starovoitov wrote:
> On Mon, Feb 17, 2025 at 7:44 AM Leon Hwang <leon.hwang@linux.dev> wrote:
>>
>> When a freplace program fails to attach to a target, the error message
>> lacks details, making debugging difficult. This patch enhances error
>> reporting by providing a log that explains why the attachment failed.
> 
> Agree that it lacks details...
> 
>> For example, if a freplace program tries to attach to a static function,
>> the log now includes:
>>
>> libbpf: prog 'new_test_pkt_access': failed to attach to freplace: -EINVAL
>> libbpf: prog 'new_test_pkt_access': attach log: subprog_tail() is not a global function
> 
> ... but adding to uapi for a minor usability improvement...
> not a long term path that is worth taking.
> Especially since freplace is special. Users don't interact with it
> directly. The interaction is typically done through libraries.
> So this extra verbosity won't help users directly, but will
> help people who write libraries. Nice, but no.

What if libbpf allows users to interact with it directly?

As for cilium/ebpf library, it will be able to provide the error message
to users like:

create link: subprog_tail() is not a global function

instead of:

create link: invalid argument

Thanks,
Leon


  reply	other threads:[~2025-02-18  3:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17 15:43 [PATCH bpf-next v3 0/4] bpf: Improve error reporting for freplace attachment failure Leon Hwang
2025-02-17 15:43 ` [PATCH bpf-next v3 1/4] bpf, verifier: Add missing newline of bpf_log in bpf_check_attach_target Leon Hwang
2025-02-17 15:43 ` [PATCH bpf-next v3 2/4] bpf: Improve error reporting for freplace attachment failure Leon Hwang
2025-02-18  3:01   ` Alexei Starovoitov
2025-02-18  3:29     ` Leon Hwang [this message]
2025-02-17 15:43 ` [PATCH bpf-next v3 3/4] bpf, libbpf: Capture and log " Leon Hwang
2025-02-17 15:43 ` [PATCH bpf-next v3 4/4] selftests/bpf: Add test case for freplace attachment failure logging Leon Hwang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a49fb92c-417f-4966-8a09-89a6cf448d6b@linux.dev \
    --to=leon.hwang@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=kernel-patches-bot@fb.com \
    --cc=me@manjusaka.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox