<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/perf/util/bpf-loader.c, branch linux-5.17.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.17.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.17.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-02-17T10:15:09Z</updated>
<entry>
<title>perf bpf: Defer freeing string after possible strlen() on it</title>
<updated>2022-02-17T10:15:09Z</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
</author>
<published>2022-02-16T19:01:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=31ded1535e3182778a1d0e5c32711f55da3bc512'/>
<id>urn:sha1:31ded1535e3182778a1d0e5c32711f55da3bc512</id>
<content type='text'>
This was detected by the gcc in Fedora Rawhide's gcc:

  50    11.01 fedora:rawhide                : FAIL gcc version 12.0.1 20220205 (Red Hat 12.0.1-0) (GCC)
        inlined from 'bpf__config_obj' at util/bpf-loader.c:1242:9:
    util/bpf-loader.c:1225:34: error: pointer 'map_opt' may be used after 'free' [-Werror=use-after-free]
     1225 |                 *key_scan_pos += strlen(map_opt);
          |                                  ^~~~~~~~~~~~~~~
    util/bpf-loader.c:1223:9: note: call to 'free' here
     1223 |         free(map_name);
          |         ^~~~~~~~~~~~~~
    cc1: all warnings being treated as errors

So do the calculations on the pointer before freeing it.

Fixes: 04f9bf2bac72480c ("perf bpf-loader: Add missing '*' for key_scan_pos")
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Ian Rogers &lt;irogers@google.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Wang ShaoBo &lt;bobo.shaobowang@huawei.com&gt;
Link: https://lore.kernel.org/lkml/Yg1VtQxKrPpS3uNA@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>Merge remote-tracking branch 'torvalds/master' into perf/core</title>
<updated>2022-01-13T13:20:59Z</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
</author>
<published>2022-01-13T13:20:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1aa77e716c6f2332f2d4664f747ff4eba731825b'/>
<id>urn:sha1:1aa77e716c6f2332f2d4664f747ff4eba731825b</id>
<content type='text'>
To pick up fixes and get in line with other trees, powerpc kernel
mostly this time, but BPF as well.

Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf bpf-loader: Use IS_ERR_OR_NULL() to clean code and fix check</title>
<updated>2021-12-16T15:18:12Z</updated>
<author>
<name>Miaoqian Lin</name>
</author>
<published>2021-12-12T13:56:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8acf3793eae4d809658b1ebeed68d818d6d38142'/>
<id>urn:sha1:8acf3793eae4d809658b1ebeed68d818d6d38142</id>
<content type='text'>
Use IS_ERR_OR_NULL() to make the code cleaner.
Also if the priv is NULL, it's improper to call PTR_ERR(priv).

Signed-off-by: Miaoqian Lin &lt;linmq006@gmail.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Alexei Starovoitov &lt;ast@kernel.org&gt;
Cc: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: John Fastabend &lt;john.fastabend@gmail.com&gt;
Cc: KP Singh &lt;kpsingh@kernel.org&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Martin KaFai Lau &lt;kafai@fb.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Song Liu &lt;songliubraving@fb.com&gt;
Cc: Yonghong Song &lt;yhs@fb.com&gt;
Cc: bpf@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: unlisted-recipients
Link: http://lore.kernel.org/lkml/20211212135613.20000-1-linmq006@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf: Mute libbpf API deprecations temporarily</title>
<updated>2021-12-03T19:54:51Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2021-12-03T00:46:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0bf40542c05ef62997738cd45eea553415adb045'/>
<id>urn:sha1:0bf40542c05ef62997738cd45eea553415adb045</id>
<content type='text'>
Libbpf development version was bumped to 0.7 in c93faaaf2f67
("libbpf: Deprecate bpf_prog_load_xattr() API"), activating a bunch of
previously scheduled deprecations. Most APIs are pretty straightforward
to replace with newer APIs, but perf has a complicated mixed setup with
libbpf used both as static and shared configurations, which makes it
non-trivial to migrate the APIs.

Further, bpf_program__set_prep() needs more involved refactoring, which
will require help from Arnaldo and/or Jiri.

So for now, mute deprecation warnings and work on migrating perf off of
deprecated APIs separately with the input from owners of the perf tool.

Fixes: c93faaaf2f67 ("libbpf: Deprecate bpf_prog_load_xattr() API")
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20211203004640.2455717-1-andrii@kernel.org
</content>
</entry>
<entry>
<title>perf tools: Fix various typos in comments</title>
<updated>2021-03-23T20:13:43Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2021-03-23T16:09:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4d39c89f0b94bf4a6e1ccf42702e7d80d210a5fd'/>
<id>urn:sha1:4d39c89f0b94bf4a6e1ccf42702e7d80d210a5fd</id>
<content type='text'>
Fix ~124 single-word typos and a few spelling errors in the perf tooling code,
accumulated over the years.

Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20210321113734.GA248990@gmail.com
Link: http://lore.kernel.org/lkml/20210323160915.GA61903@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf evlist: Use the right prefix for 'struct evlist' 'find' methods</title>
<updated>2020-11-30T12:48:07Z</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
</author>
<published>2020-11-30T12:48:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b02736f776d5f50bb13ff85eb34efaed0c3f5ffa'/>
<id>urn:sha1:b02736f776d5f50bb13ff85eb34efaed0c3f5ffa</id>
<content type='text'>
perf_evlist__ is for 'struct perf_evlist' methods, in tools/lib/perf/,
go on completing this split.

Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Ian Rogers &lt;irogers@google.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf: Stop using deprecated bpf_program__title()</title>
<updated>2020-09-09T18:28:28Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2020-09-08T18:01:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8081ede1f73139687a75147d529cebcc5e4149c5'/>
<id>urn:sha1:8081ede1f73139687a75147d529cebcc5e4149c5</id>
<content type='text'>
Switch from deprecated bpf_program__title() API to
bpf_program__section_name(). Also drop unnecessary error checks because
neither bpf_program__title() nor bpf_program__section_name() can fail or
return NULL.

Fixes: 521095842027 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name"")
Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Reviewed-by: Tobias Klauser &lt;tklauser@distanz.ch&gt;
Acked-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Link: https://lore.kernel.org/bpf/20200908180127.1249-1-andriin@fb.com
</content>
</entry>
<entry>
<title>perf bpf-loader: Add missing '*' for key_scan_pos</title>
<updated>2020-05-28T13:03:27Z</updated>
<author>
<name>Wang ShaoBo</name>
</author>
<published>2020-05-20T03:32:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=04f9bf2bac72480ca1d289b751b956dd1707a5d5'/>
<id>urn:sha1:04f9bf2bac72480ca1d289b751b956dd1707a5d5</id>
<content type='text'>
key_scan_pos is a pointer for getting scan position in
bpf__obj_config_map() for each BPF map configuration term,
but it's misused when error not happened.

Committer notes:

The point is that the only user of this is:

  tools/perf/util/parse-events.c
    err = bpf__config_obj(obj, term, parse_state-&gt;evlist, &amp;error_pos);
      if (err) bpf__strerror_config_obj(obj, term, parse_state-&gt;evlist, &amp;error_pos, err, errbuf, sizeof(errbuf));

And then:

int bpf__strerror_config_obj(struct bpf_object *obj __maybe_unused,
                             struct parse_events_term *term __maybe_unused,
                             struct evlist *evlist __maybe_unused,
                             int *error_pos __maybe_unused, int err,
                             char *buf, size_t size)
{
        bpf__strerror_head(err, buf, size);
        bpf__strerror_entry(BPF_LOADER_ERRNO__OBJCONF_MAP_TYPE,
                            "Can't use this config term with this map type");
        bpf__strerror_end(buf, size);
        return 0;
}

So this is infrastructure that Wang Nan put in place for providing
better error messages but that he ended up not using, so I'll apply the
fix, its correct even not fixing any real problem at this time.

Fixes: 066dacbf2a32 ("perf bpf: Add API to set values to map entries in a bpf object")
Signed-off-by: Wang ShaoBo &lt;bobo.shaobowang@huawei.com&gt;
Acked-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Cheng Jian &lt;cj.chengjian@huawei.com&gt;
Cc: Hanjun Guo &lt;guohanjun@huawei.com&gt;
Cc: Li Bin &lt;huawei.libin@huawei.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Wang Nan &lt;wangnan0@huawei.com&gt;
Cc: Xie XiuQi &lt;xiexiuqi@huawei.com&gt;
Cc: bpf@vger.kernel.org
Link: http://lore.kernel.org/lkml/20200520033216.48310-1-bobo.shaobowang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf evsel: Rename perf_evsel__is_*() to evsel__is*()</title>
<updated>2020-05-05T19:35:31Z</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
</author>
<published>2020-04-30T13:51:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c754c382c9a7a546087d3f52f5fcf1e1a8c3ee01'/>
<id>urn:sha1:c754c382c9a7a546087d3f52f5fcf1e1a8c3ee01</id>
<content type='text'>
As those are 'struct evsel' methods, not part of tools/lib/perf/, aka
libperf, to whom the perf_ prefix belongs.

Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>libperf: Add perf_evlist__first()/last() functions</title>
<updated>2019-09-25T12:51:48Z</updated>
<author>
<name>Jiri Olsa</name>
</author>
<published>2019-09-03T08:39:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=515dbe48f6202147fb7c88aac48c43f49db1c793'/>
<id>urn:sha1:515dbe48f6202147fb7c88aac48c43f49db1c793</id>
<content type='text'>
Add perf_evlist__first()/last() functions to libperf, as internal
functions and rename perf's origins to evlist__first/last.

Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Michael Petlan &lt;mpetlan@redhat.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: http://lore.kernel.org/lkml/20190913132355.21634-29-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
</feed>
