From: sashiko-bot@kernel.org
To: "Leon Hwang" <leon.hwang@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: Mon, 09 Nov 2026 14:22:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-205082@kernel.org> (raw)
In-Reply-To: <20261109140816.5196-4-leon.hwang@linux.dev>
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.".
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109140816.5196-1-leon.hwang@linux.dev?part=3
next prev parent reply other threads:[~2026-11-09 14:22 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 [this message]
2026-11-11 15:32 ` Leon Hwang
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=sashiko-outbox-205082@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=leon.hwang@linux.dev \
--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