Linux Perf Users
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 1/2] uprobes: Add missing read memory barrier in prepare_uprobe()
Date: Thu, 3 Dec 2026 12:19:45 +0100	[thread overview]
Message-ID: <axFQUZnsv6VDEjBJ@redhat.com> (raw)
In-Reply-To: <179629193610.2709886.11297976479121076597.stgit@mhiramat.c.googlers.com>

On 12/03, Masami Hiramatsu (Google) wrote:
>
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -1101,8 +1101,17 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file,
>  {
>  	int ret = 0;
>  
> -	if (test_bit(UPROBE_COPY_INSN, &uprobe->flags))
> +	if (test_bit(UPROBE_COPY_INSN, &uprobe->flags)) {
> +		/*
> +		 * Pairs with the smp_wmb() below.
> +		 *
> +		 * Guarantees that if we see the UPROBE_COPY_INSN bit set, then
> +		 * we must also see the stores to &uprobe->arch performed by
> +		 * prepare_uprobe().
> +		 */
> +		smp_rmb();
>  		return ret;
> +	}
>  
>  	/* TODO: move this into _register, until then we abuse this sem. */
>  	down_write(&uprobe->consumer_rwsem);
> @@ -1121,7 +1130,8 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file,
>  	if (ret)
>  		goto out;
>  
> -	smp_wmb(); /* pairs with the smp_rmb() in handle_swbp() */
> +	/* Pairs with the smp_rmb() in prepare_uprobe() and handle_swbp() */
> +	smp_wmb();
>  	set_bit(UPROBE_COPY_INSN, &uprobe->flags);

Acked-by: Oleg Nesterov <oleg@redhat.com>

But I guess we could use test_bit_acquire(UPROBE_COPY_INSN) and
smp_mb__before_atomic() before set_bit(UPROBE_COPY_INSN) ?

Oleg.


  reply	other threads:[~2026-12-03 11:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  9:58 [PATCH 0/2] uprobes: Fix UPROBE_COPY_INSN ordering and breakpoint removal Masami Hiramatsu (Google)
2026-12-03  9:58 ` [PATCH 1/2] uprobes: Add missing read memory barrier in prepare_uprobe() Masami Hiramatsu (Google)
2026-12-03 11:19   ` Oleg Nesterov [this message]
2026-12-03  9:59 ` [PATCH 2/2] uprobes: Skip remove_breakpoint() if UPROBE_COPY_INSN is not set Masami Hiramatsu (Google)
2026-12-03 10:17   ` sashiko-bot
2026-12-03 10:17 ` [PATCH 0/2] uprobes: Fix UPROBE_COPY_INSN ordering and breakpoint removal sashiko-bot

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=axFQUZnsv6VDEjBJ@redhat.com \
    --to=oleg@redhat.com \
    --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=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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