All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Hao Luo <haoluo@google.com>
Cc: 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>
Subject: Re: [PATCHv4 bpf-next 3/4] selftests/bpf: Add bpf_vma_build_id_parse find_vma callback test
Date: Tue, 29 Nov 2022 09:32:02 +0100	[thread overview]
Message-ID: <Y4XDghSltmxvtiay@krava> (raw)
In-Reply-To: <CA+khW7hks-xqS-w7ZhKkSaj6eBDWu8QEW1qgaXi5oG5KdRQoWw@mail.gmail.com>

On Mon, Nov 28, 2022 at 11:25:02AM -0800, Hao Luo wrote:
> On Mon, Nov 28, 2022 at 5:30 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Adding tests for using new bpf_vma_build_id_parse kfunc in find_vma
> > callback function.
> >
> > On bpf side the test finds the vma of the test_progs text through the
> > test function pointer and reads its build id with the new kfunc.
> >
> > On user side the test uses readelf to get test_progs build id and
> > compares it with the one from bpf side.
> >
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> <...>
> > diff --git a/tools/testing/selftests/bpf/progs/bpf_vma_build_id_parse.c b/tools/testing/selftests/bpf/progs/bpf_vma_build_id_parse.c
> > new file mode 100644
> > index 000000000000..8937212207db
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/progs/bpf_vma_build_id_parse.c
> <...>
> > +
> > +SEC("fentry/bpf_fentry_test1")
> > +int BPF_PROG(test1, int a)
> > +{
> > +       struct task_struct *task = bpf_get_current_task_btf();
> > +
> > +       if (task->pid != target_pid)
> > +               return 0;
> 
> I think here we should use task->tgid. IIRC, task->pid corresponds to
> thread id in the userspace. task->tgid is the process id.

right, will change

thanks,
jirka

> 
> > +
> > +       ret = bpf_find_vma(task, addr, check_vma, NULL, 0);
> > +       return 0;
> > +}
> <...>
> > --
> > 2.38.1
> >

  reply	other threads:[~2022-11-29  8:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 13:29 [PATCHv4 bpf-next 0/4] bpf: Add bpf_vma_build_id_parse kfunc Jiri Olsa
2022-11-28 13:29 ` [PATCHv4 bpf-next 1/4] bpf: Mark vma objects as trusted for task_vma iter and find_vma callback Jiri Olsa
2022-11-28 18:43   ` Alexei Starovoitov
2022-11-28 19:04     ` Yonghong Song
2022-11-28 20:25       ` Alexei Starovoitov
2022-11-28 13:29 ` [PATCHv4 bpf-next 2/4] bpf: Add bpf_vma_build_id_parse function and kfunc Jiri Olsa
2022-11-28 21:36   ` Alexei Starovoitov
2022-11-29  8:45     ` Jiri Olsa
2022-11-29  1:15   ` Andrii Nakryiko
2022-11-29  6:20     ` Hao Luo
2022-11-30  0:35       ` Andrii Nakryiko
2022-11-30  1:27         ` Hao Luo
2022-12-01  1:11           ` Andrii Nakryiko
2022-11-29  8:52     ` Jiri Olsa
2022-11-28 13:29 ` [PATCHv4 bpf-next 3/4] selftests/bpf: Add bpf_vma_build_id_parse find_vma callback test Jiri Olsa
2022-11-28 19:25   ` Hao Luo
2022-11-29  8:32     ` Jiri Olsa [this message]
2022-11-28 13:29 ` [PATCHv4 bpf-next 4/4] selftests/bpf: Add bpf_vma_build_id_parse task vma iterator test Jiri Olsa
2022-11-28 19:21   ` Hao Luo
2022-11-29  8:29     ` Jiri Olsa

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=Y4XDghSltmxvtiay@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.