<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/lib/bpf, branch v5.6</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.6</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.6'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-02-18T14:34:20Z</updated>
<entry>
<title>libbpf: Sanitise internal map names so they are not rejected by the kernel</title>
<updated>2020-02-18T14:34:20Z</updated>
<author>
<name>Toke Høiland-Jørgensen</name>
<email>toke@redhat.com</email>
</author>
<published>2020-02-17T17:17:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=113e6b7e15e23dc45d5c66eb66bb91a627812e36'/>
<id>urn:sha1:113e6b7e15e23dc45d5c66eb66bb91a627812e36</id>
<content type='text'>
The kernel only accepts map names with alphanumeric characters, underscores
and periods in their name. However, the auto-generated internal map names
used by libbpf takes their prefix from the user-supplied BPF object name,
which has no such restriction. This can lead to "Invalid argument" errors
when trying to load a BPF program using global variables.

Fix this by sanitising the map names, replacing any non-allowed characters
with underscores.

Fixes: d859900c4c56 ("bpf, libbpf: support global data/bss/rodata sections")
Signed-off-by: Toke Høiland-Jørgensen &lt;toke@redhat.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20200217171701.215215-1-toke@redhat.com
</content>
</entry>
<entry>
<title>libbpf: Fix realloc usage in bpf_core_find_cands</title>
<updated>2020-01-24T21:34:37Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-01-24T20:18:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=35b9211c0a2427e8f39e534f442f43804fc8d5ca'/>
<id>urn:sha1:35b9211c0a2427e8f39e534f442f43804fc8d5ca</id>
<content type='text'>
Fix bug requesting invalid size of reallocated array when constructing CO-RE
relocation candidate list. This can cause problems if there are many potential
candidates and a very fine-grained memory allocator bucket sizes are used.

Fixes: ddc7c3042614 ("libbpf: implement BPF CO-RE offset relocation algorithm")
Reported-by: William Smith &lt;williampsmith@fb.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200124201847.212528-1-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Improve handling of failed CO-RE relocations</title>
<updated>2020-01-24T21:16:26Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-01-24T05:38:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d7a252708dbc950ca2064310217e8b9f85846e2f'/>
<id>urn:sha1:d7a252708dbc950ca2064310217e8b9f85846e2f</id>
<content type='text'>
Previously, if libbpf failed to resolve CO-RE relocation for some
instructions, it would either return error immediately, or, if
.relaxed_core_relocs option was set, would replace relocatable offset/imm part
of an instruction with a bogus value (-1). Neither approach is good, because
there are many possible scenarios where relocation is expected to fail (e.g.,
when some field knowingly can be missing on specific kernel versions). On the
other hand, replacing offset with invalid one can hide programmer errors, if
this relocation failue wasn't anticipated.

This patch deprecates .relaxed_core_relocs option and changes the approach to
always replacing instruction, for which relocation failed, with invalid BPF
helper call instruction. For cases where this is expected, BPF program should
already ensure that that instruction is unreachable, in which case this
invalid instruction is going to be silently ignored. But if instruction wasn't
guarded, BPF program will be rejected at verification step with verifier log
pointing precisely to the place in assembly where the problem is.

Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Martin KaFai Lau &lt;kafai@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200124053837.2434679-1-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Add support for program extensions</title>
<updated>2020-01-22T22:04:53Z</updated>
<author>
<name>Alexei Starovoitov</name>
<email>ast@kernel.org</email>
</author>
<published>2020-01-21T00:53:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2db6eab18b9778d55f48c804f8efebd7097e7958'/>
<id>urn:sha1:2db6eab18b9778d55f48c804f8efebd7097e7958</id>
<content type='text'>
Add minimal support for program extensions. bpf_object_open_opts() needs to be
called with attach_prog_fd = target_prog_fd and BPF program extension needs to
have in .c file section definition like SEC("freplace/func_to_be_replaced").
libbpf will search for "func_to_be_replaced" in the target_prog_fd's BTF and
will pass it in attach_btf_id to the kernel. This approach works for tests, but
more compex use case may need to request function name (and attach_btf_id that
kernel sees) to be more dynamic. Such API will be added in future patches.

Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Acked-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Acked-by: Toke Høiland-Jørgensen &lt;toke@redhat.com&gt;
Link: https://lore.kernel.org/bpf/20200121005348.2769920-3-ast@kernel.org
</content>
</entry>
<entry>
<title>libbpf: Load btf_vmlinux only once per object.</title>
<updated>2020-01-17T21:59:34Z</updated>
<author>
<name>KP Singh</name>
<email>kpsingh@google.com</email>
</author>
<published>2020-01-17T21:28:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a6ed02cac690b635dbb938690e795812ce1e14ca'/>
<id>urn:sha1:a6ed02cac690b635dbb938690e795812ce1e14ca</id>
<content type='text'>
As more programs (TRACING, STRUCT_OPS, and upcoming LSM) use vmlinux
BTF information, loading the BTF vmlinux information for every program
in an object is sub-optimal. The fix was originally proposed in:

   https://lore.kernel.org/bpf/CAEf4BzZodr3LKJuM7QwD38BiEH02Cc1UbtnGpVkCJ00Mf+V_Qg@mail.gmail.com/

The btf_vmlinux is populated in the object if any of the programs in
the object requires it just before the programs are loaded and freed
after the programs finish loading.

Reported-by: Andrii Nakryiko &lt;andrii.nakryiko@gmail.com&gt;
Signed-off-by: KP Singh &lt;kpsingh@google.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Reviewed-by: Brendan Jackman &lt;jackmanb@chromium.org&gt;
Acked-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200117212825.11755-1-kpsingh@chromium.org
</content>
</entry>
<entry>
<title>libbpf: Fix potential multiplication overflow in mmap() size calculation</title>
<updated>2020-01-17T16:33:18Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-01-17T06:08:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c701917e647c6aaee5e7bbb7a2c1ca99e8552c58'/>
<id>urn:sha1:c701917e647c6aaee5e7bbb7a2c1ca99e8552c58</id>
<content type='text'>
Prevent potential overflow performed in 32-bit integers, before assigning
result to size_t. Reported by LGTM static analysis.

Fixes: eba9c5f498a1 ("libbpf: Refactor global data map initialization")
Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20200117060801.1311525-4-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Simplify BTF initialization logic</title>
<updated>2020-01-17T16:33:18Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-01-17T06:07:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b7d7f3e185b6e643dcd49d1486b11cade8519008'/>
<id>urn:sha1:b7d7f3e185b6e643dcd49d1486b11cade8519008</id>
<content type='text'>
Current implementation of bpf_object's BTF initialization is very convoluted
and thus prone to errors. It doesn't have to be like that. This patch
simplifies it significantly.

This code also triggered static analysis issues over logically dead code due
to redundant error checks. This simplification should fix that as well.

Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20200117060801.1311525-3-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Fix error handling bug in btf_dump__new</title>
<updated>2020-01-17T16:33:17Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-01-17T06:07:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bc0eb9a333918d2cc4f42f7f4cf09eaf029ac9de'/>
<id>urn:sha1:bc0eb9a333918d2cc4f42f7f4cf09eaf029ac9de</id>
<content type='text'>
Fix missing jump to error handling in btf_dump__new, found by Coverity static
code analysis.

Fixes: 9f81654eebe8 ("libbpf: Expose BTF-to-C type declaration emitting API")
Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20200117060801.1311525-2-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Revert bpf_helper_defs.h inclusion regression</title>
<updated>2020-01-17T04:01:33Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-01-17T00:41:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=20f21d98cf12b8ecd69e8defc93fae9e3b353b13'/>
<id>urn:sha1:20f21d98cf12b8ecd69e8defc93fae9e3b353b13</id>
<content type='text'>
Revert bpf_helpers.h's change to include auto-generated bpf_helper_defs.h
through &lt;&gt; instead of "", which causes it to be searched in include path. This
can break existing applications that don't have their include path pointing
directly to where libbpf installs its headers.

There is ongoing work to make all (not just bpf_helper_defs.h) includes more
consistent across libbpf and its consumers, but this unbreaks user code as is
right now without any regressions. Selftests still behave sub-optimally
(taking bpf_helper_defs.h from libbpf's source directory, if it's present
there), which will be fixed in subsequent patches.

Fixes: 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are taken from selftests dir")
Reported-by: Toke Høiland-Jørgensen &lt;toke@redhat.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20200117004103.148068-1-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Fix unneeded extra initialization in bpf_map_batch_common</title>
<updated>2020-01-16T14:31:52Z</updated>
<author>
<name>Brian Vazquez</name>
<email>brianvv@google.com</email>
</author>
<published>2020-01-16T04:59:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=858e284f0ec18bff2620d9a6afe764dc683f8ba1'/>
<id>urn:sha1:858e284f0ec18bff2620d9a6afe764dc683f8ba1</id>
<content type='text'>
bpf_attr doesn't required to be declared with '= {}' as memset is used
in the code.

Fixes: 2ab3d86ea1859 ("libbpf: Add libbpf support to batch ops")
Reported-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Brian Vazquez &lt;brianvv@google.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20200116045918.75597-1-brianvv@google.com
</content>
</entry>
</feed>
