Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH 0/2] uprobes: Fix UPROBE_COPY_INSN ordering and breakpoint removal
@ 2026-12-03  9:58 Masami Hiramatsu (Google)
  2026-12-03  9:58 ` [PATCH 1/2] uprobes: Add missing read memory barrier in prepare_uprobe() Masami Hiramatsu (Google)
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Masami Hiramatsu (Google) @ 2026-12-03  9:58 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Masami Hiramatsu, Oleg Nesterov
  Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
	Adrian Hunter, James Clark, linux-kernel, linux-trace-kernel,
	linux-perf-users

Hi,

This series fixes two bugs around UPROBE_COPY_INSN handling in
kernel/events/uprobes.c (both reported by Sashiko):

1. prepare_uprobe() uses double-checked locking around UPROBE_COPY_INSN,
   with smp_wmb() before set_bit(UPROBE_COPY_INSN, &uprobe->flags), but
   the lockless fast path returns 0 without a paired smp_rmb(). On
   weakly-ordered architectures, a concurrent caller can observe
   UPROBE_COPY_INSN set while reading stale uprobe->arch fields (such as
   auprobe->bpinsn in ARM's set_swbp()). Patch 1 adds the missing
   smp_rmb().

2. remove_breakpoint() unconditionally calls set_orig_insn(&uprobe->arch,
   ...) without checking UPROBE_COPY_INSN. If prepare_uprobe() previously
   failed or never ran, uprobe->arch.insn remains zero-initialized or
   unvalidated, and error cleanup or unregistration can overwrite an
   existing third-party software breakpoint (such as GDB) with zeroes.
   Patch 2 returns early if UPROBE_COPY_INSN is not set, paired with
   smp_rmb() before reading uprobe->arch.

Both patches are based on v7.4-rc5.

Thank you,

Masami Hiramatsu (Google) (2):
  uprobes: Add missing read memory barrier in prepare_uprobe()
  uprobes: Skip remove_breakpoint() if UPROBE_COPY_INSN is not set

 kernel/events/uprobes.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)


base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-03 10:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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  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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox