From: Jiri Olsa <olsajiri@gmail.com>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: andrii@kernel.org, ast@kernel.org, daniel@iogearbox.net,
kafai@fb.com, songliubraving@fb.com, yhs@fb.com,
john.fastabend@gmail.com, kpsingh@kernel.org, jolsa@kernel.org,
sunyucong@gmail.com, netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v3 bpf-next 4/4] selftests/bpf: add tests for u[ret]probe attach by name
Date: Sat, 26 Feb 2022 17:00:52 +0100 [thread overview]
Message-ID: <YhpOI1Yk7JlmIgLQ@krava> (raw)
In-Reply-To: <1643645554-28723-5-git-send-email-alan.maguire@oracle.com>
On Mon, Jan 31, 2022 at 04:12:34PM +0000, Alan Maguire wrote:
SNIP
> + /* verify auto-attach fails for old-style uprobe definition */
> + uprobe_err_link = bpf_program__attach(skel->progs.handle_uprobe_byname);
> + if (!ASSERT_EQ(libbpf_get_error(uprobe_err_link), -ESRCH,
> + "auto-attach should fail for old-style name"))
> + goto cleanup;
> +
> + uprobe_opts.func_name = "trigger_func2";
> + uprobe_opts.retprobe = false;
> + uprobe_opts.ref_ctr_offset = 0;
> + skel->links.handle_uprobe_byname =
> + bpf_program__attach_uprobe_opts(skel->progs.handle_uprobe_byname,
> + 0 /* this pid */,
> + "/proc/self/exe",
> + 0, &uprobe_opts);
> + if (!ASSERT_OK_PTR(skel->links.handle_uprobe_byname, "attach_uprobe_byname"))
> + goto cleanup;
> +
> + /* verify auto-attach works */
> + skel->links.handle_uretprobe_byname =
> + bpf_program__attach(skel->progs.handle_uretprobe_byname);
> + if (!ASSERT_OK_PTR(skel->links.handle_uretprobe_byname, "attach_uretprobe_byname"))
> + goto cleanup;
> +
> + /* test attach by name for a library function, using the library
> + * as the binary argument. To do this, find path to libc used
> + * by test_progs via /proc/self/maps.
> + */
> + libc_path = get_lib_path("libc-");
hi,
I'm getting crash in here because the libc line in maps for me
looks like: /usr/lib64/libc.so.6
plus the check below will let through null pointer
> + if (!ASSERT_OK_PTR(libc_path, "get path to libc"))
> + goto cleanup;
> + if (!ASSERT_NEQ(strstr(libc_path, "libc-"), NULL, "find libc path in /proc/self/maps"))
> + goto cleanup;
and when I tried to use 'libc' in here, it does not crash but
libc_path holds the whole maps line:
7fdbef31d000-7fdbef349000 r--p 00000000 fd:01 201656665 /usr/lib64/libc.so.6
so it fails, I guess there's some issue in get_lib_path
jirka
next prev parent reply other threads:[~2022-02-26 16:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-31 16:12 [PATCH v3 bpf-next 0/4] libbpf: name-based u[ret]probe attach Alan Maguire
2022-01-31 16:12 ` [PATCH v3 bpf-next 1/4] libbpf: support function name-based attach uprobes Alan Maguire
2022-02-04 19:17 ` Andrii Nakryiko
2022-02-25 16:12 ` Alan Maguire
2022-01-31 16:12 ` [PATCH v3 bpf-next 2/4] libbpf: add auto-attach for uprobes based on section name Alan Maguire
2022-02-04 19:22 ` Andrii Nakryiko
2022-02-23 9:32 ` Alan Maguire
2022-02-24 1:49 ` Andrii Nakryiko
2022-02-24 15:39 ` Alan Maguire
2022-03-01 1:45 ` Andrii Nakryiko
2022-01-31 16:12 ` [PATCH v3 bpf-next 3/4] selftests/bpf: add get_lib_path() helper Alan Maguire
2022-02-04 19:24 ` Andrii Nakryiko
2022-01-31 16:12 ` [PATCH v3 bpf-next 4/4] selftests/bpf: add tests for u[ret]probe attach by name Alan Maguire
2022-02-04 19:30 ` Andrii Nakryiko
2022-02-26 16:00 ` Jiri Olsa [this message]
2022-02-01 8:52 ` [PATCH v3 bpf-next 0/4] libbpf: name-based u[ret]probe attach Daniel Borkmann
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=YhpOI1Yk7JlmIgLQ@krava \
--to=olsajiri@gmail.com \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=sunyucong@gmail.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