[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YhpOI1Yk7JlmIgLQ@krava>
Date: Sat, 26 Feb 2022 17:00:52 +0100
From: Jiri Olsa <olsajiri@...il.com>
To: Alan Maguire <alan.maguire@...cle.com>
Cc: andrii@...nel.org, ast@...nel.org, daniel@...earbox.net,
kafai@...com, songliubraving@...com, yhs@...com,
john.fastabend@...il.com, kpsingh@...nel.org, jolsa@...nel.org,
sunyucong@...il.com, netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH v3 bpf-next 4/4] selftests/bpf: add tests for u[ret]probe
attach by name
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
Powered by blists - more mailing lists