<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/lib/bpf/libbpf_internal.h, branch linux-5.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-09-30T19:30:22Z</updated>
<entry>
<title>libbpf: Make btf_dump work with modifiable BTF</title>
<updated>2020-09-30T19:30:22Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2020-09-29T23:28:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9c6c5c48d7e9c00c541e0f1a5cea3a96767e825c'/>
<id>urn:sha1:9c6c5c48d7e9c00c541e0f1a5cea3a96767e825c</id>
<content type='text'>
Ensure that btf_dump can accommodate new BTF types being appended to BTF
instance after struct btf_dump was created. This came up during attemp to
use btf_dump for raw type dumping in selftests, but given changes are not
excessive, it's good to not have any gotchas in API usage, so I decided to
support such use case in general.

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/20200929232843.1249318-2-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Generalize common logic for managing dynamically-sized arrays</title>
<updated>2020-09-29T00:27:31Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2020-09-26T01:13:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=192f5a1fe6894dca58d14dc883e6c7030e7267f7'/>
<id>urn:sha1:192f5a1fe6894dca58d14dc883e6c7030e7267f7</id>
<content type='text'>
Managing dynamically-sized array is a common, but not trivial functionality,
which significant amount of logic and code to implement properly. So instead
of re-implementing it all the time, extract it into a helper function ans
reuse.

Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20200926011357.2366158-4-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Support test run of raw tracepoint programs</title>
<updated>2020-09-28T19:52:36Z</updated>
<author>
<name>Song Liu</name>
</author>
<published>2020-09-25T20:54:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=88f7fe7233244101fa5b7786e2e298bf27fe1375'/>
<id>urn:sha1:88f7fe7233244101fa5b7786e2e298bf27fe1375</id>
<content type='text'>
Add bpf_prog_test_run_opts() with support of new fields in bpf_attr.test,
namely, flags and cpu. Also extend _opts operations to support outputs via
opts.

Signed-off-by: Song Liu &lt;songliubraving@fb.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200925205432.1777-3-songliubraving@fb.com
</content>
</entry>
<entry>
<title>libbpf: Fix libbpf build on compilers missing __builtin_mul_overflow</title>
<updated>2020-08-20T14:45:09Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2020-08-20T06:14:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dda1ec9fc7f8383cb469a82614dbce61f357f3f8'/>
<id>urn:sha1:dda1ec9fc7f8383cb469a82614dbce61f357f3f8</id>
<content type='text'>
GCC compilers older than version 5 don't support __builtin_mul_overflow yet.
Given GCC 4.9 is the minimal supported compiler for building kernel and the
fact that libbpf is a dependency of resolve_btfids, which is dependency of
CONFIG_DEBUG_INFO_BTF=y, this needs to be handled. This patch fixes the issue
by falling back to slower detection of integer overflow in such cases.

Fixes: 029258d7b228 ("libbpf: Remove any use of reallocarray() in libbpf")
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/20200820061411.1755905-2-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Implement enum value-based CO-RE relocations</title>
<updated>2020-08-19T21:19:39Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2020-08-19T19:45:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eacaaed784e2c9da69dea3030c81062c1fd66a37'/>
<id>urn:sha1:eacaaed784e2c9da69dea3030c81062c1fd66a37</id>
<content type='text'>
Implement two relocations of a new enumerator value-based CO-RE relocation
kind: ENUMVAL_EXISTS and ENUMVAL_VALUE.

First, ENUMVAL_EXISTS, allows to detect the presence of a named enumerator
value in the target (kernel) BTF. This is useful to do BPF helper/map/program
type support detection from BPF program side. bpf_core_enum_value_exists()
macro helper is provided to simplify built-in usage.

Second, ENUMVAL_VALUE, allows to capture enumerator integer value and relocate
it according to the target BTF, if it changes. This is useful to have
a guarantee against intentional or accidental re-ordering/re-numbering of some
of the internal (non-UAPI) enumerations, where kernel developers don't care
about UAPI backwards compatiblity concerns. bpf_core_enum_value() allows to
capture this succinctly and use correct enum values in code.

LLVM uses ldimm64 instruction to capture enumerator value-based relocations,
so add support for ldimm64 instruction patching as well.

Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200819194519.3375898-5-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Implement type-based CO-RE relocations support</title>
<updated>2020-08-19T21:19:39Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2020-08-19T19:45:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3fc32f40c40207bf85ce1b007f18981c4673df96'/>
<id>urn:sha1:3fc32f40c40207bf85ce1b007f18981c4673df96</id>
<content type='text'>
Implement support for TYPE_EXISTS/TYPE_SIZE/TYPE_ID_LOCAL/TYPE_ID_REMOTE
relocations. These are examples of type-based relocations, as opposed to
field-based relocations supported already. The difference is that they are
calculating relocation values based on the type itself, not a field within
a struct/union.

Type-based relos have slightly different semantics when matching local types
to kernel target types, see comments in bpf_core_types_are_compat() for
details. Their behavior on failure to find target type in kernel BTF also
differs. Instead of "poisoning" relocatable instruction and failing load
subsequently in kernel, they return 0 (which is rarely a valid return result,
so user BPF code can use that to detect success/failure of the relocation and
deal with it without extra "guarding" relocations). Also, it's always possible
to check existence of the type in target kernel with TYPE_EXISTS relocation,
similarly to a field-based FIELD_EXISTS.

TYPE_ID_LOCAL relocation is a bit special in that it always succeeds (barring
any libbpf/Clang bugs) and resolved to BTF ID using **local** BTF info of BPF
program itself. Tests in subsequent patches demonstrate the usage and
semantics of new relocations.

Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200819194519.3375898-2-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Centralize poisoning and poison reallocarray()</title>
<updated>2020-08-19T01:38:25Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2020-08-19T01:36:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=85367030a6c7ef3373347cf816c698995074f6f0'/>
<id>urn:sha1:85367030a6c7ef3373347cf816c698995074f6f0</id>
<content type='text'>
Most of libbpf source files already include libbpf_internal.h, so it's a good
place to centralize identifier poisoning. So move kernel integer type
poisoning there. And also add reallocarray to a poison list to prevent
accidental use of it. libbpf_reallocarray() should be used universally
instead.

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/20200819013607.3607269-4-andriin@fb.com
</content>
</entry>
<entry>
<title>tools/bpftool: Remove libbpf_internal.h usage in bpftool</title>
<updated>2020-08-19T01:38:25Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2020-08-19T01:36:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7084566a236fbc98beb11430d8d67dd08b2ac151'/>
<id>urn:sha1:7084566a236fbc98beb11430d8d67dd08b2ac151</id>
<content type='text'>
Most netlink-related functions were unique to bpftool usage, so I moved them
into net.c. Few functions are still used by both bpftool and libbpf itself
internally, so I've copy-pasted them (libbpf_nl_get_link,
libbpf_netlink_open). It's a bit of duplication of code, but better separation
of libbpf as a library with public API and bpftool, relying on unexposed
functions in libbpf.

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/20200819013607.3607269-3-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Remove any use of reallocarray() in libbpf</title>
<updated>2020-08-19T01:38:25Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2020-08-19T01:36:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=029258d7b22894fabcecb1626e1b87d18a6823f4'/>
<id>urn:sha1:029258d7b22894fabcecb1626e1b87d18a6823f4</id>
<content type='text'>
Re-implement glibc's reallocarray() for libbpf internal-only use.
reallocarray(), unfortunately, is not available in all versions of glibc, so
requires extra feature detection and using reallocarray() stub from
&lt;tools/libc_compat.h&gt; and COMPAT_NEED_REALLOCARRAY. All this complicates build
of libbpf unnecessarily and is just a maintenance burden. Instead, it's
trivial to implement libbpf-specific internal version and use it throughout
libbpf.

Which is what this patch does, along with converting some realloc() uses that
should really have been reallocarray() in the first place.

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/20200819013607.3607269-2-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Clean up and improve CO-RE reloc logging</title>
<updated>2020-08-19T01:12:45Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2020-08-18T22:39:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=28b93c64499ae09d9dc8c04123b15f8654a93c4c'/>
<id>urn:sha1:28b93c64499ae09d9dc8c04123b15f8654a93c4c</id>
<content type='text'>
Add logging of local/target type kind (struct/union/typedef/etc). Preserve
unresolved root type ID (for cases of typedef). Improve the format of CO-RE
reloc spec output format to contain only relevant and succinct info.

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/20200818223921.2911963-3-andriin@fb.com
</content>
</entry>
</feed>
