[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z1_dqhXexpBz3oYB@krava>
Date: Mon, 16 Dec 2024 08:58:34 +0100
From: Jiri Olsa <olsajiri@...il.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Oleg Nesterov <oleg@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
Hao Luo <haoluo@...gle.com>, Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Alan Maguire <alan.maguire@...cle.com>,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next 10/13] selftests/bpf: Add uprobe/usdt optimized
test
On Fri, Dec 13, 2024 at 01:58:38PM -0800, Andrii Nakryiko wrote:
SNIP
> > +static int find_uprobes_trampoline(void **start, void **end)
> > +{
> > + char line[128];
> > + int ret = -1;
> > + FILE *maps;
> > +
> > + maps = fopen("/proc/self/maps", "r");
> > + if (!maps) {
> > + fprintf(stderr, "cannot open maps\n");
> > + return -1;
> > + }
> > +
> > + while (fgets(line, sizeof(line), maps)) {
> > + int m = -1;
> > +
> > + /* We care only about private r-x mappings. */
> > + if (sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n", start, end, &m) != 2)
> > + continue;
> > + if (m < 0)
> > + continue;
> > + if (!strncmp(&line[m], TRAMP, sizeof(TRAMP)-1)) {
> > + ret = 0;
> > + break;
> > + }
> > + }
>
> you could have used PROCMAP_QUERY ;)
true ;-) will check on that in new version
thanks,
jirka
>
> > +
> > + fclose(maps);
> > + return ret;
> > +}
> > +
>
> [...]
Powered by blists - more mailing lists