Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Binbin Deng" <18983559317@163.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1] uprobe: Assign session ID before publishing consumer
Date: Mon, 19 Oct 2026 08:10:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-176777@kernel.org> (raw)
In-Reply-To: <20261019080709.477548-1-18983559317@163.com>

> consumer_add() publishes a consumer on uprobe->consumers
> before assigning its session ID.  handler_chain() traverses the consumer
> list under the trace RCU read-side critical section and can therefore
> observe the new consumer while uc->id still contains its initial value.
> 
> The race is reachable when an uprobe at the same inode:offset is already
> active and a task hits its entry breakpoint while another CPU registers a
> second session consumer.  handler_chain() may store the stale ID in the
> return_instance consumer array.  By the time the function returns,
> uc->id has been assigned a nonzero value, so return_consumer_find() fails
> to match the saved ID and the session ret_handler is incorrectly skipped.
> 
> consumer_rwsem does not close this window because handler_chain() is an RCU
> reader and does not take that rwsem.  Assign the ID before list_add_rcu()
> publishes the consumer; the release publish of the list node then orders
> the initialized ID before readers that traverse the list.
> 
> Found during a static-analysis-assisted audit: candidate sites were
> surfaced by a Coccinelle rule, and the reader/writer paths were
> confirmed by LLM-assisted (GLM-5.3) code inspection.  The issue was
> not observed at runtime; it is identified by code inspection only.
> 
> Fixes: 4d756095d399 ("uprobe: Add support for session consumer")
> Signed-off-by: Binbin Deng <18983559317@163.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261019080709.477548-1-18983559317@163.com?part=1


  reply	other threads:[~2026-10-19  8:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  8:07 [PATCH v1] uprobe: Assign session ID before publishing consumer Binbin Deng
2026-10-19  8:10 ` sashiko-bot [this message]
2026-10-19 10:51 ` Oleg Nesterov
2026-10-19 16:08   ` Andrii Nakryiko
2026-10-19 16:30     ` Oleg Nesterov
2026-10-19 18:52       ` 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=sashiko-outbox-176777@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=18983559317@163.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