Re: [PATCH v2 2/2] riscv: probes: reject probes inside an LR/SC sequence

From: Nam Cao

Date: Thu Nov 12 2026 - 02:59:16 EST


Vladimir Kondratiev <vladimir.kondratiev@xxxxxxxxxxxx> writes:
> A kprobe or uprobe replaces an instruction with a breakpoint. The trap
> clears the hart's reservation, so if the breakpoint sits on the lr, on
> the sc, or on any instruction between them, the sc fails, the loop
> branches back to the lr and the probe fires again. The sequence never
> completes.

Xiaofeng sent a series addressing the same issue:
https://lore.kernel.org/linux-riscv/20261019134121.1763-1-yuanxiaofeng@xxxxxxxxxxxxxxxxxx/#t

I have only skimmed this patch, but this patch has an important
difference: riscv_probe_in_lrsc_body(), while the other series
implements a kunit.

Perhaps you two should join forces?

Nam