Re: [PATCH 2/2] uprobes: Skip remove_breakpoint() if UPROBE_COPY_INSN is not set

From: Oleg Nesterov

Date: Thu Dec 03 2026 - 06:59:07 EST


On 12/03, Masami Hiramatsu (Google) wrote:
>
> @@ -1194,6 +1197,19 @@ static int remove_breakpoint(struct uprobe *uprobe, struct vm_area_struct *vma,
> {
> struct mm_struct *mm = vma->vm_mm;
>
> + /* No breakpoint was ever installed if prepare_uprobe() never succeeded */
> + if (!test_bit(UPROBE_COPY_INSN, &uprobe->flags))
> + return 0;
> +
> + /*
> + * Pairs with the smp_wmb() in prepare_uprobe().
> + *
> + * Guarantees that if we see the UPROBE_COPY_INSN bit set, then
> + * we must also see the stores to &uprobe->arch before
> + * set_orig_insn() reads them.
> + */
> + smp_rmb();

Acked-by: Oleg Nesterov <oleg@xxxxxxxxxx>

But again, it can use test_bit_acquire() unless I am confused.

And perhaps it would be better to change uprobe_unregister_nosync()
to check UPROBE_COPY_INSN once?

In any case UPROBE_COPY_INSN must die ;) see the TODO comment in
prepare_uprobe().

Oleg.