[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzYb=mqN84a8+xc-Du1QkUBYMgwAuStYqastJJHQE4Os5g@mail.gmail.com>
Date: Thu, 4 Sep 2025 12:42:23 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>, Jiri Olsa <olsajiri@...il.com>,
Masami Hiramatsu <mhiramat@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
Andrii Nakryiko <andrii@...nel.org>, bpf <bpf@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-trace-kernel <linux-trace-kernel@...r.kernel.org>, X86 ML <x86@...nel.org>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>, Hao Luo <haoluo@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>, Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH perf/core 02/11] uprobes: Skip emulate/sstep on unique
uprobe when ip is changed
On Thu, Sep 4, 2025 at 11:57 AM Oleg Nesterov <oleg@...hat.com> wrote:
>
> On 09/04, Andrii Nakryiko wrote:
> >
> > On Thu, Sep 4, 2025 at 8:02 AM Alexei Starovoitov
> > <alexei.starovoitov@...il.com> wrote:
> > >
> > > On Thu, Sep 4, 2025 at 4:26 AM Oleg Nesterov <oleg@...hat.com> wrote:
> > > >
> > > > On 09/04, Jiri Olsa wrote:
> > > > >
> > > > >
> > > > > 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
> > > >
> > > > Yes, this is what I meant,
> > > >
> > > > > IIUC Andrii would remove the unique flag completely?
> > > >
> > > > Lets wait for Andrii...
> > >
> > > Not Andrii, but I see only negatives in this extra flag.
> > > It doesn't add any safety or guardrails.
> > > No need to pollute uapi with pointless flags.
> >
> > +1. I think it's fine to just have something like
> >
> > if (unlikely(instruction_pointer(regs) != bp_vaddr))
> > goto out;
> >
> > after all uprobe callbacks were processed. Even if every single one of
> > them modify IP, the last one that did that wins.
>
> OK. If any consumer can change regs->ip, then I can only repeat:
>
> Yes... but what if we there are multiple consumers? The 1st one changes
> instruction_pointer, the next is unaware. Or it may change regs->ip too...
>
> > Others (if they care)
> > can detect this.
>
> How? If the the consumer which changes regs->ip is not the 1st one?
>
We are probably speaking past each other. uprobe consumers (including
BPF ones) see struct pt_regs, so they get what's the latest regs->ip.
Sure, they won't know that it was changed, but oh well, not sure that
matters all that much. And if it does matter, then we can solve that
by giving users ability to carefully order consumers (we have similar
problems and some solutions for that in BPF for some other BPF
programs; it just never been necessary for uprobes/kprobes
specifically).
> That said. If you guys don't see a problem - I won't even try to argue.
I don't, yep.
>
> As I said many times, I have no idea how people actually use uprobes ;)
>
> Oleg.
>
Powered by blists - more mailing lists