All of lore.kernel.org
 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>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Menglong Dong <menglong8.dong@gmail.com>
Subject: Re: [RFC PATCH bpf-next 3/5] bpf: Report freplace attach failure reason via extended syscall
Date: Fri, 1 Aug 2025 21:45:06 +0800	[thread overview]
Message-ID: <90775658-23ad-42cd-b75e-ecbb1b62fde5@linux.dev> (raw)
In-Reply-To: <CAADnVQJ-wC5kpGZMzU5O7cd-m_4hKA-tjkAm42xEqh2Lu_v_hw@mail.gmail.com>



On 2025/8/1 00:32, Alexei Starovoitov wrote:
> On Mon, Jul 28, 2025 at 7:24 AM Leon Hwang <leon.hwang@linux.dev> wrote:
>>
>> This patch enables detailed error reporting when a freplace program fails
>> to attach to its target.
>>
>> By leveraging the extended 'bpf()' syscall with common attributes, users
>> can now retrieve the failure reason through the provided log buffer.
>>
>> Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
>> ---
>>  kernel/bpf/syscall.c | 39 +++++++++++++++++++++++++++++++--------
>>  1 file changed, 31 insertions(+), 8 deletions(-)
>>
>> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
>> index ca7ce8474812..4d1f58b14a0a 100644
>> --- a/kernel/bpf/syscall.c
>> +++ b/kernel/bpf/syscall.c
>> @@ -3446,7 +3446,8 @@ static int bpf_tracing_prog_attach(struct bpf_prog *prog,
>>                                    int tgt_prog_fd,
>>                                    u32 btf_id,
>>                                    u64 bpf_cookie,
>> -                                  enum bpf_attach_type attach_type)
>> +                                  enum bpf_attach_type attach_type,
>> +                                  struct bpf_verifier_log *log)
> 
> Same issue as before.
> Nack on adding new uapi for the sole purpose of freplace.
> 

Got it.

> Patches 1 and 2 are fine, but must follow with patch(es) that
> make common_attrs usable for existing commands like prog_load and btf_load.
> We need to decide what to do when prog_load's log_buf conflicts
> with common_attrs.log_buf.
> I think it's ok if they both specified and are exactly the same.
> If one of them is specified and another is zero it's also ok.
> When they conflict it's an EINVAL or, maybe, EUSERS to make it distinct.
> After that map_create cmd should adopt log and disambiguate all EINVAL-s
> into human readable messages.

Let me have a try.

Thanks,
Leon



  reply	other threads:[~2025-08-01 13:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-28 14:23 [RFC PATCH bpf-next 0/5] bpf: Extend bpf syscall with common attributes support Leon Hwang
2025-07-28 14:23 ` [RFC PATCH bpf-next 1/5] " Leon Hwang
2025-07-29  3:43   ` kernel test robot
2025-07-29  3:55     ` Leon Hwang
2025-07-28 14:23 ` [RFC PATCH bpf-next 2/5] libbpf: Add support for extended bpf syscall Leon Hwang
2025-07-28 14:23 ` [RFC PATCH bpf-next 3/5] bpf: Report freplace attach failure reason via extended syscall Leon Hwang
2025-07-31 16:32   ` Alexei Starovoitov
2025-08-01 13:45     ` Leon Hwang [this message]
2025-07-28 14:23 ` [RFC PATCH bpf-next 4/5] libbpf: Capture error message on freplace attach failure Leon Hwang
2025-07-28 14:23 ` [RFC PATCH bpf-next 5/5] selftests/bpf: Add case to test freplace attach failure log 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=90775658-23ad-42cd-b75e-ecbb1b62fde5@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=menglong8.dong@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.