From: sashiko-bot@kernel.org
To: "Danish Khateeb" <danishkhateeb03@gmail.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2] perf/core: Don't send SIGTRAP after exec removed the event
Date: Wed, 30 Sep 2026 14:57:26 +0000 [thread overview]
Message-ID: <20260930145726.B02331F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260930144248.59858-1-danishkhateeb03@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Missing READ_ONCE() on concurrent lockless access to event->state
--
commit a39b84d0fe4531dad91da56d867a84ee0e8c6cf6
Author: Danish Khateeb <danishkhateeb03@gmail.com>
perf/core: Don't send SIGTRAP after exec removed the event
This commit prevents sending a SIGTRAP to a process after an exec() call has
removed the perf event. It adds a state check in perf_sigtrap() to ensure
signals are skipped if the event state indicates it has already been removed.
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 634d2ccbab82d..eabe6cdf7a888 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
[ ... ]
> @@ -7631,6 +7631,15 @@ static void perf_sigtrap(struct perf_event *event)
> if (current->flags & PF_EXITING)
> return;
>
> + /*
> + * The event was removed after this signal was queued, e.g. by exec()
> + * (remove_on_exec), which may also have closed its fd (close-on-exec).
> + * The new program has default signal handlers, so a SIGTRAP would
> + * kill it.
> + */
> + if (event->state <= PERF_EVENT_STATE_EXIT)
[Severity: Low]
Does this lockless read of event->state need a READ_ONCE() annotation?
If another thread sharing the file descriptor calls close(), perf_release()
can run concurrently on another CPU and modify event->state using
WRITE_ONCE(). Under the kernel memory model, reading a variable that can be
concurrently modified typically requires READ_ONCE() to prevent compiler
optimizations like tearing or rematerialization, and to avoid data race
warnings.
> + return;
> +
> /*
> * We'd expect this to only occur if the irq_work is delayed and either
> * ctx->task or current has changed in the meantime. This can be the
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260930144248.59858-1-danishkhateeb03@gmail.com?part=1
next prev parent reply other threads:[~2026-09-30 14:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 14:42 [PATCH v2] perf/core: Don't send SIGTRAP after exec removed the event Danish Khateeb
2026-09-30 14:57 ` sashiko-bot [this message]
2026-09-30 15:16 ` Peter Zijlstra
2026-09-30 15:59 ` Danishk2445
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=20260930145726.B02331F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=danishkhateeb03@gmail.com \
--cc=linux-perf-users@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