From: Leon Hwang <leon.hwang@linux.dev>
To: sashiko-reviews@lists.linux.dev, bpf@vger.kernel.org
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next 3/9] bpf: Add log support for iter link_create
Date: Wed, 11 Nov 2026 23:32:10 +0800 [thread overview]
Message-ID: <b7d1f4cf-7488-4fe7-a8c2-280dd8e49dd1@linux.dev> (raw)
In-Reply-To: <sashiko-outbox-205082@kernel.org>
On 2026/11/9 22:22, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] bpf: misattributed iter_info error log messages in
> bpf_iter_link_attach()
> --
>
> commit d8f64c129a2738b81f1bf280ca7bbad040d70081
> Author: Leon Hwang <leon.hwang@linux.dev>
>
> bpf: Add log support for iter link_create
>
> This commit passes the verifier log to bpf_iter_link_attach() and logs
> diagnostic messages when BPF_LINK_CREATE fails for iterator programs.
>
>> diff --git a/kernel/bpf/bpf_iter.c b/kernel/bpf/bpf_iter.c
>> index f0b29a1709357..dfefa5579e033 100644
>> --- a/kernel/bpf/bpf_iter.c
>> +++ b/kernel/bpf/bpf_iter.c
> [ ... ]
>> @@ -538,24 +539,36 @@ int bpf_iter_link_attach(const union bpf_attr *attr, bpfptr_t uattr,
> [ ... ]
>> if (!bpfptr_is_null(ulinfo)) {
>> err = bpf_check_uarg_tail_zero(ulinfo, sizeof(linfo),
>> linfo_len);
>> - if (err)
>> + if (err) {
>> + bpf_log(log, "Invalid iter_info.\n");
>> return err;
>> + }
>> linfo_len = min_t(u32, linfo_len, sizeof(linfo));
>> - if (copy_from_bpfptr(&linfo, ulinfo, linfo_len))
>> + if (copy_from_bpfptr(&linfo, ulinfo, linfo_len)) {
>> + bpf_log(log, "Invalid iter_info_len.\n");
>> return -EFAULT;
>> + }
>> }
>
> [Severity: Low]
> Are the log messages for iter_info and iter_info_len swapped or
> misattributed here?
>
> By the time copy_from_bpfptr() runs, linfo_len has already been clamped to
> sizeof(linfo), so copy_from_bpfptr() only fails when reading from the
> ulinfo pointer (attr->link_create.iter_info) faults, yet it logs "Invalid
> iter_info_len.". Conversely, bpf_check_uarg_tail_zero() rejects linfo_len
> values larger than PAGE_SIZE with -E2BIG without touching ulinfo, which
> logs "Invalid iter_info.".
>
Sounds reasonable to me, will swap them in the next revision.
Thanks,
Leon
next prev parent reply other threads:[~2026-11-11 15:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 14:08 [PATCH bpf-next 0/9] bpf: Add log support for tracing link_create Leon Hwang
2026-11-09 14:08 ` [PATCH bpf-next 1/9] " Leon Hwang
2026-11-09 14:47 ` bot+bpf-ci
2026-11-11 15:31 ` Leon Hwang
2026-11-09 14:08 ` [PATCH bpf-next 2/9] bpf: Add log support for tracing_multi link_create Leon Hwang
2026-11-09 14:08 ` [PATCH bpf-next 3/9] bpf: Add log support for iter link_create Leon Hwang
2026-11-09 14:22 ` sashiko-bot
2026-11-11 15:32 ` Leon Hwang [this message]
2026-11-09 14:08 ` [PATCH bpf-next 4/9] bpf: Add log support for cgroup prog link_create Leon Hwang
2026-11-09 14:47 ` bot+bpf-ci
2026-11-11 15:32 ` Leon Hwang
2026-11-09 14:08 ` [PATCH bpf-next 5/9] libbpf: Add log_opts support for BPF_TRACE_ITER Leon Hwang
2026-11-09 14:36 ` sashiko-bot
2026-11-11 15:33 ` Leon Hwang
2026-11-09 14:47 ` bot+bpf-ci
2026-11-11 15:32 ` Leon Hwang
2026-11-09 14:08 ` [PATCH bpf-next 6/9] selftests/bpf: Verify tracing link_create logs Leon Hwang
2026-11-09 14:47 ` bot+bpf-ci
2026-11-11 15:34 ` Leon Hwang
2026-11-09 14:08 ` [PATCH bpf-next 7/9] selftests/bpf: Verify tracing_multi " Leon Hwang
2026-11-09 14:08 ` [PATCH bpf-next 8/9] selftests/bpf: Verify iter " Leon Hwang
2026-11-09 14:08 ` [PATCH bpf-next 9/9] selftests/bpf: Verify cgroup prog " 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=b7d1f4cf-7488-4fe7-a8c2-280dd8e49dd1@linux.dev \
--to=leon.hwang@linux.dev \
--cc=bpf@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-reviews@lists.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