From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Liangyan <liangyan.peng@bytedance.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
namhyung@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
irogers@google.com, adrian.hunter@intel.com,
james.clark@linaro.org, zengxianjun@bytedance.com,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] perf/core: Fix pending work re-queued in __perf_event_overflow
Date: Tue, 11 Nov 2025 14:30:23 +0100 [thread overview]
Message-ID: <20251111133023.YqDNgQak@linutronix.de> (raw)
In-Reply-To: <20251109164122.80138-1-liangyan.peng@bytedance.com>
On 2025-11-10 00:41:22 [+0800], Liangyan wrote:
> We got warning below during perf test.
…
>
> A race condition occurs between task context and IRQ context when
> handling sigtrap tracepoint event overflows:
>
> 1. In task context, an event is overflowed and its pending work is
> queued to task->task_works
> 2. Before pending_work is set, the same event overflows in IRQ context
> 3. Both contexts queue the same perf pending work to task->task_works
>
> This double queuing causes:
> - task_work_run() enters infinite loop calling perf_pending_task()
> - Potential warnings and use-after-free when event is freed in
> perf_pending_task()
>
> Fix the race by disabling interrupts during queuing of perf pending work.
Makes sense. Lets it does not overflow in NMI, too.
Either way I suggest to trim the commit message and remove the
backtrace as it probably does not add any value.
Sebastian
next prev parent reply other threads:[~2025-11-11 13:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-09 10:32 [PATCH] " Liangyan
2025-11-09 11:45 ` Peter Zijlstra
2025-11-09 16:41 ` [PATCH v2] " Liangyan
2025-11-11 13:30 ` Sebastian Andrzej Siewior [this message]
2025-11-12 3:28 ` [External] " Liangyan
2025-11-14 3:33 ` [PATCH v3] " Liangyan
2025-11-14 8:02 ` Sebastian Andrzej Siewior
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=20251111133023.YqDNgQak@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=liangyan.peng@bytedance.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=zengxianjun@bytedance.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®