Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: vineash <vineash30640@gmail.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2] perf/core: Fix double put of the system-wide perf_ctx_data reference
Date: Wed, 07 Oct 2026 17:24:12 +0000	[thread overview]
Message-ID: <sashiko-outbox-163240@kernel.org> (raw)
In-Reply-To: <179139291278.1120510.13167877618594247003@gmail.com>

> The reference on a task's perf_ctx_data that belongs to the system-wide
> events (cd->global) can be put twice. __detach_global_ctx_data() puts it
> when the last system-wide event goes away, and perf_event_exit_task()
> puts it again when the task exits. perf_event_exit_task() runs without
> global_ctx_data_rwsem and never clears cd->global, so nothing stops both
> paths from putting the same reference:
> 
>   CPU0                               CPU1 (task T exiting)
>   __detach_global_ctx_data()
>     cd->global = 0;
>     detach_task_ctx_data(T)
>       refcount_dec_and_test() == true
>                                      perf_event_exit_task(T)
>                                        detach_task_ctx_data(T)
>                                          cd = T->perf_ctx_data;
> [ ... ]
> put it when they are freed.
> 
> Fixes: 506e64e710ff ("perf: attach/detach PMU specific data")
> Assisted-by: Claude:claude-opus-5-5 syzkaller
> Signed-off-by: vineash <vineash30640@gmail.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/179139291278.1120510.13167877618594247003@gmail.com?part=1


      reply	other threads:[~2026-10-07 17:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 17:08 [PATCH v2] perf/core: Fix double put of the system-wide perf_ctx_data reference vineash
2026-10-07 17:24 ` sashiko-bot [this message]

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-163240@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vineash30640@gmail.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