Re: [PATCH perf/core 02/11] uprobes: Skip emulate/sstep on unique uprobe when ip is changed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 04, 2025 at 10:49:50AM +0200, Oleg Nesterov wrote:
> On 09/03, Jiri Olsa wrote:
> >
> > On Wed, Sep 03, 2025 at 01:26:48PM +0200, Oleg Nesterov wrote:
> > > On 09/02, Jiri Olsa wrote:
> > > >
> > > > If user decided to take execution elsewhere, it makes little sense
> > > > to execute the original instruction, so let's skip it.
> > >
> > > Exactly.
> > >
> > > So why do we need all these "is_unique" complications? Only a single
> > > is_unique/exclusive consumer can change regs->ip, so I guess handle_swbp()
> > > can just do
> > >
> > > 	handler_chain(uprobe, regs);
> > > 	if (instruction_pointer(regs) != bp_vaddr)
> > > 		goto out;
> >
> > hum, that's what I did in rfc [1] but I thought you did not like that [2]
> >
> > [1] https://lore.kernel.org/bpf/20250801210238.2207429-2-jolsa@xxxxxxxxxx/
> > [2] https://lore.kernel.org/bpf/20250802103426.GC31711@xxxxxxxxxx/
> >
> > I guess I misunderstood your reply [2], I'd be happy to drop the
> > unique/exclusive flag
> 
> Well, but that rfc didn't introduce the exclusive consumers, and I think
> we agree that even with these changes the non-exclusive consumers must
> never change regs->ip?

ok, got excited too soon.. so you meant getting rid of is_unique
check only for this patch and have just change below..  but keep
the unique/exclusive flag from patch#1

IIUC Andrii would remove the unique flag completely?

jirka


--
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index b9b088f7333a..1baf5d2792ff 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -2791,6 +2791,9 @@ static void handle_swbp(struct pt_regs *regs)
 
 	handler_chain(uprobe, regs);
 
+	if (instruction_pointer(regs) != bp_vaddr)
+		goto out;
+
 	/* Try to optimize after first hit. */
 	arch_uprobe_optimize(&uprobe->arch, bp_vaddr);
 




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux