<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/lib/bpf/libbpf.map, branch v5.11</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.11</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.11'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-12-14T18:04:55Z</updated>
<entry>
<title>libbpf: Expose libbpf ring_buffer epoll_fd</title>
<updated>2020-12-14T18:04:55Z</updated>
<author>
<name>Brendan Jackman</name>
<email>jackmanb@google.com</email>
</author>
<published>2020-12-14T11:38:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a4d2a7ad86834092b327082004ead755d2603376'/>
<id>urn:sha1:a4d2a7ad86834092b327082004ead755d2603376</id>
<content type='text'>
This provides a convenient perf ringbuf -&gt; libbpf ringbuf migration
path for users of external polling systems. It is analogous to
perf_buffer__epoll_fd.

Signed-off-by: Brendan Jackman &lt;jackmanb@google.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20201214113812.305274-1-jackmanb@google.com
</content>
</entry>
<entry>
<title>libbpf: Separate XDP program load with xsk socket creation</title>
<updated>2020-12-03T18:37:59Z</updated>
<author>
<name>Mariusz Dudek</name>
<email>mariuszx.dudek@intel.com</email>
</author>
<published>2020-12-03T09:05:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e459f49b4394e2630ea55d5ac7a49402686848fe'/>
<id>urn:sha1:e459f49b4394e2630ea55d5ac7a49402686848fe</id>
<content type='text'>
Add support for separation of eBPF program load and xsk socket
creation.

This is needed for use-case when you want to privide as little
privileges as possible to the data plane application that will
handle xsk socket creation and incoming traffic.

With this patch the data entity container can be run with only
CAP_NET_RAW capability to fulfill its purpose of creating xsk
socket and handling packages. In case your umem is larger or
equal process limit for MEMLOCK you need either increase the
limit or CAP_IPC_LOCK capability.

To resolve privileges issue two APIs are introduced:

- xsk_setup_xdp_prog - loads the built in XDP program. It can
also return xsks_map_fd which is needed by unprivileged process
to update xsks_map with AF_XDP socket "fd"

- xsk_socket__update_xskmap - inserts an AF_XDP socket into an xskmap
for a particular xsk_socket

Signed-off-by: Mariusz Dudek &lt;mariuszx.dudek@intel.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Magnus Karlsson &lt;magnus.karlsson@intel.com&gt;
Link: https://lore.kernel.org/bpf/20201203090546.11976-2-mariuszx.dudek@intel.com
</content>
</entry>
<entry>
<title>libbpf: Add base BTF accessor</title>
<updated>2020-12-03T18:17:26Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2020-12-02T06:52:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0cfdcd6378071f383c900e3d8862347e2af1d1ca'/>
<id>urn:sha1:0cfdcd6378071f383c900e3d8862347e2af1d1ca</id>
<content type='text'>
Add ability to get base BTF. It can be also used to check if BTF is split BTF.

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/20201202065244.530571-3-andrii@kernel.org
</content>
</entry>
<entry>
<title>libbpf: Implement basic split BTF support</title>
<updated>2020-11-06T02:37:30Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2020-11-05T04:33:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ba451366bf44498f22dd16c31a792083bd6f2ae1'/>
<id>urn:sha1:ba451366bf44498f22dd16c31a792083bd6f2ae1</id>
<content type='text'>
Support split BTF operation, in which one BTF (base BTF) provides basic set of
types and strings, while another one (split BTF) builds on top of base's types
and strings and adds its own new types and strings. From API standpoint, the
fact that the split BTF is built on top of the base BTF is transparent.

Type numeration is transparent. If the base BTF had last type ID #N, then all
types in the split BTF start at type ID N+1. Any type in split BTF can
reference base BTF types, but not vice versa. Programmatically construction of
a split BTF on top of a base BTF is supported: one can create an empty split
BTF with btf__new_empty_split() and pass base BTF as an input, or pass raw
binary data to btf__new_split(), or use btf__parse_xxx_split() variants to get
initial set of split types/strings from the ELF file with .BTF section.

String offsets are similarly transparent and are a logical continuation of
base BTF's strings. When building BTF programmatically and adding a new string
(explicitly with btf__add_str() or implicitly through appending new
types/members), string-to-be-added would first be looked up from the base
BTF's string section and re-used if it's there. If not, it will be looked up
and/or added to the split BTF string section. Similarly to type IDs, types in
split BTF can refer to strings from base BTF absolutely transparently (but not
vice versa, of course, because base BTF doesn't "know" about existence of
split BTF).

Internal type index is slightly adjusted to be zero-indexed, ignoring a fake
[0] VOID type. This allows to handle split/base BTF type lookups transparently
by using btf-&gt;start_id type ID offset, which is always 1 for base/non-split
BTF and equals btf__get_nr_types(base_btf) + 1 for the split BTF.

BTF deduplication is not yet supported for split BTF and support for it will
be added in separate patch.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Song Liu &lt;songliubraving@fb.com&gt;
Link: https://lore.kernel.org/bpf/20201105043402.2530976-5-andrii@kernel.org
</content>
</entry>
<entry>
<title>libbpf: Add support for freplace attachment in bpf_link_create</title>
<updated>2020-09-29T20:09:24Z</updated>
<author>
<name>Toke Høiland-Jørgensen</name>
<email>toke@redhat.com</email>
</author>
<published>2020-09-29T12:45:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a535909142bf2a6f3a95cabbb8b38ce3860c4807'/>
<id>urn:sha1:a535909142bf2a6f3a95cabbb8b38ce3860c4807</id>
<content type='text'>
This adds support for supplying a target btf ID for the bpf_link_create()
operation, and adds a new bpf_program__attach_freplace() high-level API for
attaching freplace functions with a target.

Signed-off-by: Toke Høiland-Jørgensen &lt;toke@redhat.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Link: https://lore.kernel.org/bpf/160138355387.48470.18026176785351166890.stgit@toke.dk
</content>
</entry>
<entry>
<title>libbpf: Support BTF loading and raw data output in both endianness</title>
<updated>2020-09-29T19:21:23Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-09-29T04:30:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3289959b97cac205df006fc79c88f042bf2765ab'/>
<id>urn:sha1:3289959b97cac205df006fc79c88f042bf2765ab</id>
<content type='text'>
Teach BTF to recognized wrong endianness and transparently convert it
internally to host endianness. Original endianness of BTF will be preserved
and used during btf__get_raw_data() to convert resulting raw data to the same
endianness and a source raw_data. This means that little-endian host can parse
big-endian BTF with no issues, all the type data will be presented to the
client application in native endianness, but when it's time for emitting BTF
to persist it in a file (e.g., after BTF deduplication), original non-native
endianness will be preserved and stored.

It's possible to query original endianness of BTF data with new
btf__endianness() API. It's also possible to override desired output
endianness with btf__set_endianness(), so that if application needs to load,
say, big-endian BTF and store it as little-endian BTF, it's possible to
manually override this. If btf__set_endianness() was used to change
endianness, btf__endianness() will reflect overridden endianness.

Given there are no known use cases for supporting cross-endianness for
.BTF.ext, loading .BTF.ext in non-native endianness is not supported.

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/20200929043046.1324350-3-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Add btf__str_by_offset() as a more generic variant of name_by_offset</title>
<updated>2020-09-29T02:17:13Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-09-29T02:05:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f86ed050bcee3b7daa420eb31a8b6d079701caab'/>
<id>urn:sha1:f86ed050bcee3b7daa420eb31a8b6d079701caab</id>
<content type='text'>
BTF strings are used not just for names, they can be arbitrary strings used
for CO-RE relocations, line/func infos, etc. Thus "name_by_offset" terminology
is too specific and might be misleading. Instead, introduce
btf__str_by_offset() API which uses generic string terminology.

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/20200929020533.711288-3-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Add BTF writing APIs</title>
<updated>2020-09-29T02:17:13Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-09-29T02:05:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4a3b33f8579af182ebcf9c7e9304effce505500e'/>
<id>urn:sha1:4a3b33f8579af182ebcf9c7e9304effce505500e</id>
<content type='text'>
Add APIs for appending new BTF types at the end of BTF object.

Each BTF kind has either one API of the form btf__add_&lt;kind&gt;(). For types
that have variable amount of additional items (struct/union, enum, func_proto,
datasec), additional API is provided to emit each such item. E.g., for
emitting a struct, one would use the following sequence of API calls:

btf__add_struct(...);
btf__add_field(...);
...
btf__add_field(...);

Each btf__add_field() will ensure that the last BTF type is of STRUCT or
UNION kind and will automatically increment that type's vlen field.

All the strings are provided as C strings (const char *), not a string offset.
This significantly improves usability of BTF writer APIs. All such strings
will be automatically appended to string section or existing string will be
re-used, if such string was already added previously.

Each API attempts to do all the reasonable validations, like enforcing
non-empty names for entities with required names, proper value bounds, various
bit offset restrictions, etc.

Type ID validation is minimal because it's possible to emit a type that refers
to type that will be emitted later, so libbpf has no way to enforce such
cases. User must be careful to properly emit all the necessary types and
specify type IDs that will be valid in the finally generated BTF.

Each of btf__add_&lt;kind&gt;() APIs return new type ID on success or negative
value on error. APIs like btf__add_field() that emit additional items
return zero on success and negative value on error.

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/20200929020533.711288-2-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Add btf__new_empty() to create an empty BTF object</title>
<updated>2020-09-29T00:27:32Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-09-26T01:13:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a871b04310248024e022e104eba3ec81d144cc64'/>
<id>urn:sha1:a871b04310248024e022e104eba3ec81d144cc64</id>
<content type='text'>
Add an ability to create an empty BTF object from scratch. This is going to be
used by pahole for BTF encoding. And also by selftest for convenient creation
of BTF objects.

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-7-andriin@fb.com
</content>
</entry>
<entry>
<title>libbpf: Allow modification of BTF and add btf__add_str API</title>
<updated>2020-09-29T00:27:31Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-09-26T01:13:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=919d2b1dbb074d438027135ba644411931179a59'/>
<id>urn:sha1:919d2b1dbb074d438027135ba644411931179a59</id>
<content type='text'>
Allow internal BTF representation to switch from default read-only mode, in
which raw BTF data is a single non-modifiable block of memory with BTF header,
types, and strings layed out sequentially and contiguously in memory, into
a writable representation with types and strings data split out into separate
memory regions, that can be dynamically expanded.

Such writable internal representation is transparent to users of libbpf APIs,
but allows to append new types and strings at the end of BTF, which is
a typical use case when generating BTF programmatically. All the basic
guarantees of BTF types and strings layout is preserved, i.e., user can get
`struct btf_type *` pointer and read it directly. Such btf_type pointers might
be invalidated if BTF is modified, so some care is required in such mixed
read/write scenarios.

Switch from read-only to writable configuration happens automatically the
first time when user attempts to modify BTF by either adding a new type or new
string. It is still possible to get raw BTF data, which is a single piece of
memory that can be persisted in ELF section or into a file as raw BTF. Such
raw data memory is also still owned by BTF and will be freed either when BTF
object is freed or if another modification to BTF happens, as any modification
invalidates BTF raw representation.

This patch adds the first two BTF manipulation APIs: btf__add_str(), which
allows to add arbitrary strings to BTF string section, and btf__find_str()
which allows to find existing string offset, but not add it if it's missing.
All the added strings are automatically deduplicated. This is achieved by
maintaining an additional string lookup index for all unique strings. Such
index is built when BTF is switched to modifiable mode. If at that time BTF
strings section contained duplicate strings, they are not de-duplicated. This
is done specifically to not modify the existing content of BTF (types, their
string offsets, etc), which can cause confusion and is especially important
property if there is struct btf_ext associated with struct btf. By following
this "imperfect deduplication" process, btf_ext is kept consitent and correct.
If deduplication of strings is necessary, it can be forced by doing BTF
deduplication, at which point all the strings will be eagerly deduplicated and
all string offsets both in struct btf and struct btf_ext will be updated.

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