<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/lib/bpf/libbpf.map, branch v6.0</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=v6.0</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2022-07-29T22:30:06Z</updated>
<entry>
<title>libbpf: Add bpf_obj_get_opts()</title>
<updated>2022-07-29T22:30:06Z</updated>
<author>
<name>Joe Burton</name>
<email>jevburton@google.com</email>
</author>
<published>2022-07-29T20:27:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=395fc4fa33e98944384d0d6c8b3ecd9fb4b50d00'/>
<id>urn:sha1:395fc4fa33e98944384d0d6c8b3ecd9fb4b50d00</id>
<content type='text'>
Add an extensible variant of bpf_obj_get() capable of setting the
`file_flags` parameter.

This parameter is needed to enable unprivileged access to BPF maps.
Without a method like this, users must manually make the syscall.

Signed-off-by: Joe Burton &lt;jevburton@google.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220729202727.3311806-1-jevburton.kernel@gmail.com
</content>
</entry>
<entry>
<title>libbpf: add ksyscall/kretsyscall sections support for syscall kprobes</title>
<updated>2022-07-19T16:33:18Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2022-07-14T07:07:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=708ac5bea0ce51fa1d70a44a1f817c8b02787c1e'/>
<id>urn:sha1:708ac5bea0ce51fa1d70a44a1f817c8b02787c1e</id>
<content type='text'>
Add SEC("ksyscall")/SEC("ksyscall/&lt;syscall_name&gt;") and corresponding
kretsyscall variants (for return kprobes) to allow users to kprobe
syscall functions in kernel. These special sections allow to ignore
complexities and differences between kernel versions and host
architectures when it comes to syscall wrapper and corresponding
__&lt;arch&gt;_sys_&lt;syscall&gt; vs __se_sys_&lt;syscall&gt; differences, depending on
whether host kernel has CONFIG_ARCH_HAS_SYSCALL_WRAPPER (though libbpf
itself doesn't rely on /proc/config.gz for detecting this, see
BPF_KSYSCALL patch for how it's done internally).

Combined with the use of BPF_KSYSCALL() macro, this allows to just
specify intended syscall name and expected input arguments and leave
dealing with all the variations to libbpf.

In addition to SEC("ksyscall+") and SEC("kretsyscall+") add
bpf_program__attach_ksyscall() API which allows to specify syscall name
at runtime and provide associated BPF cookie value.

At the moment SEC("ksyscall") and bpf_program__attach_ksyscall() do not
handle all the calling convention quirks for mmap(), clone() and compat
syscalls. It also only attaches to "native" syscall interfaces. If host
system supports compat syscalls or defines 32-bit syscalls in 64-bit
kernel, such syscall interfaces won't be attached to by libbpf.

These limitations may or may not change in the future. Therefore it is
recommended to use SEC("kprobe") for these syscalls or if working with
compat and 32-bit interfaces is required.

Tested-by: Alan Maguire &lt;alan.maguire@oracle.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20220714070755.3235561-5-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: perfbuf: Add API to get the ring buffer</title>
<updated>2022-07-15T19:53:22Z</updated>
<author>
<name>Jon Doron</name>
<email>jond@wiz.io</email>
</author>
<published>2022-07-15T18:11:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9ff5efdeb0897547cffc275e88d2a55462d9b08e'/>
<id>urn:sha1:9ff5efdeb0897547cffc275e88d2a55462d9b08e</id>
<content type='text'>
Add support for writing a custom event reader, by exposing the ring
buffer.

With the new API perf_buffer__buffer() you will get access to the
raw mmaped()'ed per-cpu underlying memory of the ring buffer.

This region contains both the perf buffer data and header
(struct perf_event_mmap_page), which manages the ring buffer
state (head/tail positions, when accessing the head/tail position
it's important to take into consideration SMP).
With this type of low level access one can implement different types of
consumers here are few simple examples where this API helps with:

1. perf_event_read_simple is allocating using malloc, perhaps you want
   to handle the wrap-around in some other way.
2. Since perf buf is per-cpu then the order of the events is not
   guarnteed, for example:
   Given 3 events where each event has a timestamp t0 &lt; t1 &lt; t2,
   and the events are spread on more than 1 CPU, then we can end
   up with the following state in the ring buf:
   CPU[0] =&gt; [t0, t2]
   CPU[1] =&gt; [t1]
   When you consume the events from CPU[0], you could know there is
   a t1 missing, (assuming there are no drops, and your event data
   contains a sequential index).
   So now one can simply do the following, for CPU[0], you can store
   the address of t0 and t2 in an array (without moving the tail, so
   there data is not perished) then move on the CPU[1] and set the
   address of t1 in the same array.
   So you end up with something like:
   void **arr[] = [&amp;t0, &amp;t1, &amp;t2], now you can consume it orderely
   and move the tails as you process in order.
3. Assuming there are multiple CPUs and we want to start draining the
   messages from them, then we can "pick" with which one to start with
   according to the remaining free space in the ring buffer.

Signed-off-by: Jon Doron &lt;jond@wiz.io&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220715181122.149224-1-arilou@gmail.com
</content>
</entry>
<entry>
<title>libbpf: implement bpf_prog_query_opts</title>
<updated>2022-06-29T20:21:52Z</updated>
<author>
<name>Stanislav Fomichev</name>
<email>sdf@google.com</email>
</author>
<published>2022-06-28T17:43:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a4b2f3cf699f8ec3964722e7ef3f37f809701172'/>
<id>urn:sha1:a4b2f3cf699f8ec3964722e7ef3f37f809701172</id>
<content type='text'>
Implement bpf_prog_query_opts as a more expendable version of
bpf_prog_query. Expose new prog_attach_flags and attach_btf_func_id as
well:

* prog_attach_flags is a per-program attach_type; relevant only for
  lsm cgroup program which might have different attach_flags
  per attach_btf_id
* attach_btf_func_id is a new field expose for prog_query which
  specifies real btf function id for lsm cgroup attachments

Acked-by: Martin KaFai Lau &lt;kafai@fb.com&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Link: https://lore.kernel.org/r/20220628174314.1216643-10-sdf@google.com
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: fix up few libbpf.map problems</title>
<updated>2022-06-28T20:13:33Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2022-06-27T21:15:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ab9a5a05dc480f8994eddd31093a8920b08ee71d'/>
<id>urn:sha1:ab9a5a05dc480f8994eddd31093a8920b08ee71d</id>
<content type='text'>
Seems like we missed to add 2 APIs to libbpf.map and another API was
misspelled. Fix it in libbpf.map.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20220627211527.2245459-16-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: remove multi-instance and custom private data APIs</title>
<updated>2022-06-28T20:13:32Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2022-06-27T21:15:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b4bda502dfa28c7cb78e25f24593fc1d4628b21c'/>
<id>urn:sha1:b4bda502dfa28c7cb78e25f24593fc1d4628b21c</id>
<content type='text'>
Remove all the public APIs that are related to creating multi-instance
bpf_programs through custom preprocessing callback and generally working
with them.

Also remove all the bpf_{object,map,program}__[set_]priv() APIs.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20220627211527.2245459-10-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: remove most other deprecated high-level APIs</title>
<updated>2022-06-28T20:13:32Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2022-06-27T21:15:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=146bf811f5ac133e619fcf4e77bc7a97a9e401e7'/>
<id>urn:sha1:146bf811f5ac133e619fcf4e77bc7a97a9e401e7</id>
<content type='text'>
Remove a bunch of high-level bpf_object/bpf_map/bpf_program related
APIs. All the APIs related to private per-object/map/prog state,
program preprocessing callback, and generally everything multi-instance
related is removed in a separate patch.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20220627211527.2245459-9-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: remove prog_info_linear APIs</title>
<updated>2022-06-28T20:13:32Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2022-06-27T21:15:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9a590538ba4fbe6d0a4586cdab039df782153fcb'/>
<id>urn:sha1:9a590538ba4fbe6d0a4586cdab039df782153fcb</id>
<content type='text'>
Remove prog_info_linear-related APIs previously used by perf.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20220627211527.2245459-8-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: clean up perfbuf APIs</title>
<updated>2022-06-28T20:13:32Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2022-06-27T21:15:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=22dd7a58b2e9965c1a612b6a09c4a6146cbb5873'/>
<id>urn:sha1:22dd7a58b2e9965c1a612b6a09c4a6146cbb5873</id>
<content type='text'>
Remove deprecated perfbuf APIs and clean up opts structs.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20220627211527.2245459-7-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: remove deprecated BTF APIs</title>
<updated>2022-06-28T20:13:32Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2022-06-27T21:15:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=aaf6886d9b53d34f0a3d2f577ddc1224026d12ab'/>
<id>urn:sha1:aaf6886d9b53d34f0a3d2f577ddc1224026d12ab</id>
<content type='text'>
Get rid of deprecated BTF-related APIs.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20220627211527.2245459-6-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
</feed>
