BPF List
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	bpf@vger.kernel.org, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Borislav Petkov (AMD)" <bp@alien8.de>,
	x86@kernel.org
Subject: Re: [PATCH bpf-next 3/3] selftests/bpf: Add uretprobe syscall test for regs changes
Date: Sun, 31 Mar 2024 21:32:02 +0200	[thread overview]
Message-ID: <Zgm6Mjg0Ke8BaEBA@krava> (raw)
In-Reply-To: <CAEf4BzYXFX3Mx+3Z2BLHrUw5dG7qaz7R2Tfc82R+OMhT14rDBg@mail.gmail.com>

On Fri, Mar 29, 2024 at 03:34:00PM -0700, Andrii Nakryiko wrote:
> On Wed, Mar 27, 2024 at 3:21 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Adding test that creates uprobe consumer on uretprobe which changes some
> > of the registers. Making sure the changed registers are propagated to the
> > user space when the ureptobe syscall trampoline is used on x86_64.
> >
> > To be able to do this, adding support to bpf_testmod to create uprobe via
> > new attribute file:
> >   /sys/kernel/bpf_testmod_uprobe
> >
> > This file is expecting file offset and creates related uprobe on current
> > process exe file and removes existing uprobe if offset is 0. The can be
> > only single uprobe at any time.
> >
> > The uprobe has specific consumer that changes registers used in ureprobe
> > syscall trampoline and which are later checked in the test.
> >
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  .../selftests/bpf/bpf_testmod/bpf_testmod.c   | 119 +++++++++++++++++-
> >  .../selftests/bpf/prog_tests/uprobe_syscall.c |  67 ++++++++++
> >  2 files changed, 185 insertions(+), 1 deletion(-)
> >
> 
> LGTM:
> 
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
> 
> [...]
> 
> >  BTF_KFUNCS_START(bpf_testmod_common_kfunc_ids)
> >  BTF_ID_FLAGS(func, bpf_iter_testmod_seq_new, KF_ITER_NEW)
> >  BTF_ID_FLAGS(func, bpf_iter_testmod_seq_next, KF_ITER_NEXT | KF_RET_NULL)
> > @@ -650,7 +763,10 @@ static int bpf_testmod_init(void)
> >                 return ret;
> >         if (bpf_fentry_test1(0) < 0)
> >                 return -EINVAL;
> > -       return sysfs_create_bin_file(kernel_kobj, &bin_attr_bpf_testmod_file);
> > +       ret = sysfs_create_bin_file(kernel_kobj, &bin_attr_bpf_testmod_file);
> > +       if (ret < 0)
> > +               return ret;
> > +       return register_bpf_testmod_uprobe();
> 
> nit: keep using the same pattern to make adding more actions easier in
> the future:
> 
> ret = register_bpf_testmod_uprobe();
> if (ret < 0)
>     return ret;
> return 0;

ok, will change 

thanks,
jirka

> 
> >  }
> >
> >  static void bpf_testmod_exit(void)
> > @@ -664,6 +780,7 @@ static void bpf_testmod_exit(void)
> >                 msleep(20);
> >
> >         sysfs_remove_bin_file(kernel_kobj, &bin_attr_bpf_testmod_file);
> > +       unregister_bpf_testmod_uprobe();
> >  }
> >
> 
> [...]

      reply	other threads:[~2024-03-31 19:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 10:20 [PATCH bpf-next 0/3] uprobe: uretprobe speed up Jiri Olsa
2024-03-27 10:20 ` [PATCH bpf-next 1/3] uprobe: Add uretprobe syscall to speed up return probe Jiri Olsa
2024-03-27 11:45   ` Oleg Nesterov
2024-03-29 22:24   ` Andrii Nakryiko
2024-03-27 10:20 ` [PATCH bpf-next 2/3] selftests/bpf: Add uretprobe syscall test for regs integrity Jiri Olsa
2024-03-29 22:30   ` Andrii Nakryiko
2024-03-29 22:34     ` Andrii Nakryiko
2024-03-31 19:37     ` Jiri Olsa
2024-04-01  9:47       ` Masami Hiramatsu
2024-03-27 10:20 ` [PATCH bpf-next 3/3] selftests/bpf: Add uretprobe syscall test for regs changes Jiri Olsa
2024-03-29 22:34   ` Andrii Nakryiko
2024-03-31 19:32     ` Jiri Olsa [this message]

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=Zgm6Mjg0Ke8BaEBA@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=songliubraving@fb.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --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