BPF List
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Ihor Solodrai <ihor.solodrai@pm.me>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	bpf@vger.kernel.org, Martin KaFai Lau <kafai@fb.com>,
	Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@chromium.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Masami Hiramatsu <mhiramat@kernel.org>
Subject: Re: [PATCHv3 bpf-next 2/2] selftests/bpf: Add uprobe multi consumers test
Date: Tue, 24 Sep 2024 13:13:32 +0200	[thread overview]
Message-ID: <ZvKe3LGtJP5Otvrn@krava> (raw)
In-Reply-To: <CAEf4Bzb2dTK0jgc69O9Ouu3=5qeTT=RMAa3Na3V7LztN6y8bUw@mail.gmail.com>

On Tue, Sep 24, 2024 at 07:44:50AM +0200, Andrii Nakryiko wrote:

SNIP

> > > + /
> > > + * uprobe return is tricky ;-)
> > > + *
> > > + * to trigger uretprobe consumer, the uretprobe needs to be installed,
> > > + * which means one of the 'return' uprobes was alive when probe was hit:
> > > + *
> > > + * idxs: 2/3 uprobe return in 'installed' mask
> > > + *
> > > + * in addition if 'after' state removes everything that was installed in
> > > + * 'before' state, then uprobe kernel object goes away and return uprobe
> > > + * is not installed and we won't hit it even if it's in 'after' state.
> > > + */
> > > + unsigned long had_uretprobes = before & 0b1100; // is uretprobe installed
> > > + unsigned long probe_preserved = before & after; // did uprobe go away
> > > +
> > > + if (had_uretprobes && probe_preserved && test_bit(idx, after))
> > > + val++;
> > > + fmt = "idx 2/3: uretprobe";
> > > + }
> >
> > Jiri, Andrii,
> >
> > This test case started failing since upstream got merged into bpf-next,
> > starting from commit https://git.kernel.org/bpf/bpf-next/c/440b65232829

thanks for the report

SNIP

> 
> Thanks for the mitigation! I think this is due to my recent RCU and
> refcounting changes to uprobes/uretprobes, which went through
> tip/perf/core initially. And now that tip and bpf-next trees
> converged, this condition:
> 
>   > unsigned long probe_preserved = before & after; // did uprobe go away
> 
> is no longer correct, and uretprobe can be activated if there was
> *any* uretprobe installed before.
> 
> So the test needs adjustment, but I don't think anything really broke.
> I don't remember exactly (and given the conferencing schedule and
> quite bad internet can't test quickly), but I think the condition
> should now be:
> 
> unsigned long probe_preserved = after & 0x1100;
> 
> (though we might want to also rename the variable to be a bit more
> meaningful now).
> 
> Anyways, I don't think this is critical and we can address this later.
> But if anyone is willing to send a fix, I'd appreciate it, of course!

I think we can remove that check completely.. I sent the patch, let's discuss there ;-)

thanks,
jirka

  reply	other threads:[~2024-09-24 11:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-22 20:27 [PATCHv3 bpf-next 0/2] selftests/bpf: Add more uprobe multi tests Jiri Olsa
2024-07-22 20:27 ` [PATCHv3 bpf-next 1/2] selftests/bpf: Add uprobe fail tests for uprobe multi Jiri Olsa
2024-07-22 20:27 ` [PATCHv3 bpf-next 2/2] selftests/bpf: Add uprobe multi consumers test Jiri Olsa
2024-07-23 20:23   ` Andrii Nakryiko
2024-09-24  0:33   ` Ihor Solodrai
2024-09-24  5:44     ` Andrii Nakryiko
2024-09-24 11:13       ` Jiri Olsa [this message]
2024-07-22 20:51 ` [PATCHv3 bpf-next 0/2] selftests/bpf: Add more uprobe multi tests bot+bpf-ci
2024-07-23  1:41 ` bot+bpf-ci
2024-07-23  2:37 ` bot+bpf-ci
2024-07-23 20:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZvKe3LGtJP5Otvrn@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=ihor.solodrai@pm.me \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=mhiramat@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sdf@google.com \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox