From: sashiko-bot@kernel.org
To: "Ihor Solodrai" <ihor.solodrai@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v6 3/3] bpf: Cache build IDs in sleepable stackmap path
Date: Fri, 22 May 2026 00:13:16 +0000 [thread overview]
Message-ID: <20260522001316.E227C1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260521225022.2695755-4-ihor.solodrai@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The code incorrectly uses `!vma->vm_file` to determine if a VMA has a backing file instead of using `vma_is_anonymous()`.
--
commit 064bc7134cce521fa9fe6d8d8e8a26a362f8ccdb
Author: Ihor Solodrai <ihor.solodrai@linux.dev>
bpf: Cache build IDs in sleepable stackmap path
This commit adds caching for the last successfully parsed build ID,
VMA range, and backing file in the sleepable stackmap path to avoid
repeated VMA locking and file parsing.
> diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
> --- a/kernel/bpf/stackmap.c
> +++ b/kernel/bpf/stackmap.c
[ ... ]
> @@ -253,6 +261,17 @@ static void stack_map_get_build_id_offset_sleepable(struct bpf_stack_build_id *i
> for (u32 i = 0; i < trace_nr; i++) {
> ip = READ_ONCE(id_offs[i].ip);
[ ... ]
> vma = stack_map_lock_vma(&lock, ip);
> if (!vma || !vma->vm_file) {
[Severity: High]
This is a pre-existing issue, but using vma->vm_file as a proxy to check if
a VMA is file-backed or anonymous can be problematic. Anonymous VMAs (like
private mappings of /dev/zero or driver mmaps that call vma_set_anonymous())
can leave vma->vm_file set.
If this code treats such VMAs as standard file-backed VMAs, could
build_id_parse_file() end up invoking kernel_read() on character devices
like TTYs or input devices?
This might block indefinitely waiting for input, potentially leading to a
local denial of service in a sleepable BPF tracing program.
Should this check use vma_is_anonymous(vma) to accurately classify the VMA
instead of checking !vma->vm_file?
> stack_map_build_id_set_ip(&id_offs[i]);
> stack_map_unlock_vma(&lock);
> continue;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260521225022.2695755-1-ihor.solodrai@linux.dev?part=3
next prev parent reply other threads:[~2026-05-22 0:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 22:50 [PATCH bpf-next v6 0/3] bpf: Implement stack_map_get_build_id_offset_sleepable() Ihor Solodrai
2026-05-21 22:50 ` [PATCH bpf-next v6 1/3] bpf: Factor out stack_map build ID helpers Ihor Solodrai
2026-05-21 23:16 ` sashiko-bot
2026-05-21 23:32 ` Ihor Solodrai
2026-05-22 17:17 ` Andrii Nakryiko
2026-05-22 17:16 ` Andrii Nakryiko
2026-05-22 17:33 ` Ihor Solodrai
2026-05-22 17:50 ` Andrii Nakryiko
2026-05-21 22:50 ` [PATCH bpf-next v6 2/3] bpf: Avoid faultable build ID reads under mm locks Ihor Solodrai
2026-05-21 23:33 ` bot+bpf-ci
2026-05-21 23:41 ` sashiko-bot
2026-05-22 17:42 ` Andrii Nakryiko
2026-05-22 18:04 ` Ihor Solodrai
2026-05-22 18:14 ` Andrii Nakryiko
2026-05-21 22:50 ` [PATCH bpf-next v6 3/3] bpf: Cache build IDs in sleepable stackmap path Ihor Solodrai
2026-05-21 23:33 ` bot+bpf-ci
2026-05-22 0:13 ` sashiko-bot [this message]
2026-05-22 17:46 ` Andrii Nakryiko
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=20260522001316.E227C1F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=ihor.solodrai@linux.dev \
--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 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.