From: sashiko-bot@kernel.org
To: "Luo Gengkun" <luogengkun@huaweicloud.com>
Cc: linux-perf-users@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH stable/linux-6.6.y 4/9] perf/bpf: Call BPF handler directly, not through overflow machinery
Date: Thu, 26 Nov 2026 04:22:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-234729@kernel.org> (raw)
In-Reply-To: <20261126043458.2394658-5-luogengkun@huaweicloud.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] perf: missing SLAB_ACCOUNT in perf_event_init() [1]
--
commit 4af8ba4aec15ed1b6050b9027e93e306d86849aa
Author: Kyle Huey <me@kylehuey.com>
perf/bpf: Call BPF handler directly, not through overflow machinery
This commit refactors BPF perf event overflow handling to invoke
bpf_overflow_handler() directly from __perf_event_overflow() instead of
replacing event->overflow_handler, and removes orig_overflow_handler from
struct perf_event.
Link: https://lore.kernel.org/r/20240412015019.7060-5-khuey@kylehuey.com
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 523d9bbc305bd..ba9cbf50773e8 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
[ ... ]
> @@ -12121,13 +12118,11 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
> overflow_handler = parent_event->overflow_handler;
> context = parent_event->overflow_handler_context;
> #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_EVENT_TRACING)
> - if (overflow_handler == bpf_overflow_handler) {
> + if (parent_event->prog) {
> struct bpf_prog *prog = parent_event->prog;
>
> bpf_prog_inc(prog);
> event->prog = prog;
> - event->orig_overflow_handler =
> - parent_event->orig_overflow_handler;
> }
> #endif
> }
[Severity: High]
This problem wasn't introduced by this patch, but should perf_event_cache
use SLAB_ACCOUNT (or GFP_KERNEL_ACCOUNT in perf_event_alloc()) so that
struct perf_event allocations are charged to the calling process's memory
cgroup [1]?
perf_event_init() creates perf_event_cache with KMEM_CACHE(perf_event,
SLAB_PANIC), and perf_event_alloc() allocates from it with GFP_KERNEL |
__GFP_ZERO. A containerized task can repeatedly call perf_event_open() to
allocate unaccounted perf_event objects, bypassing its memcg limits and
exhausting host kernel memory.
[1] https://sashiko.dev/#/bug/linux-83d96148-5109-41b8-9975-d17680148a68
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126043458.2394658-1-luogengkun@huaweicloud.com?part=4
next prev parent reply other threads:[~2026-11-26 4:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 4:34 [PATCH stable/linux-6.6.y 0/9] perf/bpf: Fix NULL pointer dereference Luo Gengkun
2026-11-26 4:22 ` sashiko-bot
2026-11-26 4:34 ` [PATCH stable/linux-6.6.y 1/9] perf/bpf: Reorder bpf_overflow_handler() ahead of __perf_event_overflow() Luo Gengkun
2026-11-26 4:34 ` [PATCH stable/linux-6.6.y 2/9] perf/bpf: Create bpf_overflow_handler() stub for !CONFIG_BPF_SYSCALL Luo Gengkun
2026-11-26 4:34 ` [PATCH stable/linux-6.6.y 3/9] perf/bpf: Remove #ifdef CONFIG_BPF_SYSCALL from struct perf_event members Luo Gengkun
2026-11-26 4:34 ` [PATCH stable/linux-6.6.y 4/9] perf/bpf: Call BPF handler directly, not through overflow machinery Luo Gengkun
2026-11-26 4:22 ` sashiko-bot [this message]
2026-11-26 4:34 ` [PATCH stable/linux-6.6.y 5/9] perf/bpf: Remove unneeded uses_default_overflow_handler() Luo Gengkun
2026-11-26 4:34 ` [PATCH stable/linux-6.6.y 6/9] perf/bpf: Allow a BPF program to suppress all sample side effects Luo Gengkun
2026-11-26 4:34 ` [PATCH stable/linux-6.6.y 7/9] perf/bpf: Change the !CONFIG_BPF_SYSCALL stubs to static inlines Luo Gengkun
2026-11-26 4:34 ` [PATCH stable/linux-6.6.y 8/9] perf/bpf: Mark perf_event_set_bpf_handler() and perf_event_free_bpf_handler() as inline too Luo Gengkun
2026-11-26 4:34 ` [PATCH stable/linux-6.6.y 9/9] perf/bpf: Don't call bpf_overflow_handler() for tracing events Luo Gengkun
2026-11-27 17:01 ` [PATCH stable/linux-6.6.y 0/9] perf/bpf: Fix NULL pointer dereference Sasha Levin
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-234729@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=luogengkun@huaweicloud.com \
--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.