<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/git/stable/linux.git/tools/bpf, branch linux-5.19.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<id>https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/atom?h=linux-5.19.y</id>
<link rel='self' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/atom?h=linux-5.19.y'/>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/'/>
<updated>2022-10-24T07:58:10+00:00</updated>
<entry>
<title>bpftool: Clear errno after libcap's checks</title>
<updated>2022-10-24T07:58:10+00:00</updated>
<author>
<name>Quentin Monnet</name>
<email>quentin@isovalent.com</email>
</author>
<published>2022-08-15T16:22:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8735e5c122b6176e3017c35a24a24fcc5284d160'/>
<id>urn:sha1:8735e5c122b6176e3017c35a24a24fcc5284d160</id>
<content type='text'>
[ Upstream commit cea558855c39b7f1f02ff50dcf701ca6596bc964 ]

When bpftool is linked against libcap, the library runs a "constructor"
function to compute the number of capabilities of the running kernel
[0], at the beginning of the execution of the program. As part of this,
it performs multiple calls to prctl(). Some of these may fail, and set
errno to a non-zero value:

    # strace -e prctl ./bpftool version
    prctl(PR_CAPBSET_READ, CAP_MAC_OVERRIDE) = 1
    prctl(PR_CAPBSET_READ, 0x30 /* CAP_??? */) = -1 EINVAL (Invalid argument)
    prctl(PR_CAPBSET_READ, CAP_CHECKPOINT_RESTORE) = 1
    prctl(PR_CAPBSET_READ, 0x2c /* CAP_??? */) = -1 EINVAL (Invalid argument)
    prctl(PR_CAPBSET_READ, 0x2a /* CAP_??? */) = -1 EINVAL (Invalid argument)
    prctl(PR_CAPBSET_READ, 0x29 /* CAP_??? */) = -1 EINVAL (Invalid argument)
    ** fprintf added at the top of main(): we have errno == 1
    ./bpftool v7.0.0
    using libbpf v1.0
    features: libbfd, libbpf_strict, skeletons
    +++ exited with 0 +++

This has been addressed in libcap 2.63 [1], but until this version is
available everywhere, we can fix it on bpftool side.

Let's clean errno at the beginning of the main() function, to make sure
that these checks do not interfere with the batch mode, where we error
out if errno is set after a bpftool command.

  [0] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/tree/libcap/cap_alloc.c?h=libcap-2.65#n20
  [1] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=f25a1b7e69f7b33e6afb58b3e38f3450b7d2d9a0

Signed-off-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20220815162205.45043-1-quentin@isovalent.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpftool: Fix a wrong type cast in btf_dumper_int</title>
<updated>2022-10-24T07:57:05+00:00</updated>
<author>
<name>Lam Thai</name>
<email>lamthai@arista.com</email>
</author>
<published>2022-08-24T22:59:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b35f60d6cf97b1518c3d60f52a9a395bb7f614a4'/>
<id>urn:sha1:b35f60d6cf97b1518c3d60f52a9a395bb7f614a4</id>
<content type='text'>
[ Upstream commit 7184aef9c0f7a81db8fd18d183ee42481d89bf35 ]

When `data` points to a boolean value, casting it to `int *` is problematic
and could lead to a wrong value being passed to `jsonw_bool`. Change the
cast to `bool *` instead.

Fixes: b12d6ec09730 ("bpf: btf: add btf print functionality")
Signed-off-by: Lam Thai &lt;lamthai@arista.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Reviewed-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20220824225859.9038-1-lamthai@arista.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpftool: Use sysfs vmlinux when dumping BTF by ID</title>
<updated>2022-05-13T23:07:53+00:00</updated>
<author>
<name>Larysa Zaremba</name>
<email>larysa.zaremba@intel.com</email>
</author>
<published>2022-05-13T12:17:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=418fbe82578e2889dcc2c0ae4d367ea4e28dd05c'/>
<id>urn:sha1:418fbe82578e2889dcc2c0ae4d367ea4e28dd05c</id>
<content type='text'>
Currently, dumping almost all BTFs specified by id requires
using the -B option to pass the base BTF. For kernel module
BTFs the vmlinux BTF sysfs path should work.

This patch simplifies dumping by ID usage by loading
vmlinux BTF from sysfs as base, if base BTF was not specified
and the ID corresponds to a kernel module BTF.

Signed-off-by: Larysa Zaremba &lt;larysa.zaremba@intel.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Reviewed-by: Alexander Lobakin &lt;alexandr.lobakin@intel.com&gt;
Link: https://lore.kernel.org/bpf/20220513121743.12411-1-larysa.zaremba@intel.com
</content>
</entry>
<entry>
<title>bpf, x86: Generate trampolines from bpf_tramp_links</title>
<updated>2022-05-11T00:50:40+00:00</updated>
<author>
<name>Kui-Feng Lee</name>
<email>kuifeng@fb.com</email>
</author>
<published>2022-05-10T20:59:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f7e0beaf39d3868dc700d4954b26cf8443c5d423'/>
<id>urn:sha1:f7e0beaf39d3868dc700d4954b26cf8443c5d423</id>
<content type='text'>
Replace struct bpf_tramp_progs with struct bpf_tramp_links to collect
struct bpf_tramp_link(s) for a trampoline.  struct bpf_tramp_link
extends bpf_link to act as a linked list node.

arch_prepare_bpf_trampoline() accepts a struct bpf_tramp_links to
collects all bpf_tramp_link(s) that a trampoline should call.

Change BPF trampoline and bpf_struct_ops to pass bpf_tramp_links
instead of bpf_tramp_progs.

Signed-off-by: Kui-Feng Lee &lt;kuifeng@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220510205923.3206889-2-kuifeng@fb.com
</content>
</entry>
<entry>
<title>bpftool: bpf_link_get_from_fd support for LSM programs in lskel</title>
<updated>2022-05-10T17:42:08+00:00</updated>
<author>
<name>KP Singh</name>
<email>kpsingh@kernel.org</email>
</author>
<published>2022-05-09T21:49:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=bd2331b3757f5b2ab4aafc591b55fa2a592abf7c'/>
<id>urn:sha1:bd2331b3757f5b2ab4aafc591b55fa2a592abf7c</id>
<content type='text'>
bpf_link_get_from_fd currently returns a NULL fd for LSM programs.
LSM programs are similar to tracing programs and can also use
skel_raw_tracepoint_open.

Signed-off-by: KP Singh &lt;kpsingh@kernel.org&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220509214905.3754984-1-kpsingh@kernel.org
</content>
</entry>
<entry>
<title>bpftool: Declare generator name</title>
<updated>2022-05-10T00:42:53+00:00</updated>
<author>
<name>Jason Wang</name>
<email>jasowang@redhat.com</email>
</author>
<published>2022-05-09T09:02:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=56c3e749d08a041454f5d75273c24d16240f26dc'/>
<id>urn:sha1:56c3e749d08a041454f5d75273c24d16240f26dc</id>
<content type='text'>
Most code generators declare its name so did this for bfptool.

Signed-off-by: Jason Wang &lt;jasowang@redhat.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220509090247.5457-1-jasowang@redhat.com
</content>
</entry>
<entry>
<title>bpftool: Output message if no helpers found in feature probing</title>
<updated>2022-05-10T00:16:05+00:00</updated>
<author>
<name>Milan Landaverde</name>
<email>milan@mdaverde.com</email>
</author>
<published>2022-05-04T16:13:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b06a92a18d4651c983c60d83935a76b2d47d85e0'/>
<id>urn:sha1:b06a92a18d4651c983c60d83935a76b2d47d85e0</id>
<content type='text'>
Currently in libbpf, we have hardcoded program types that are not
supported for helper function probing (e.g. tracing, ext, lsm).
Due to this (and other legitimate failures), bpftool feature probe returns
empty for those program type helper functions.

Instead of implying to the user that there are no helper functions
available for a program type, we output a message to the user explaining
that helper function probing failed for that program type.

Signed-off-by: Milan Landaverde &lt;milan@mdaverde.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220504161356.3497972-3-milan@mdaverde.com
</content>
</entry>
<entry>
<title>bpftool: Adjust for error codes from libbpf probes</title>
<updated>2022-05-10T00:16:05+00:00</updated>
<author>
<name>Milan Landaverde</name>
<email>milan@mdaverde.com</email>
</author>
<published>2022-05-04T16:13:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=6d9f63b9df5ed7ffe10ac70025f408d28b3dd260'/>
<id>urn:sha1:6d9f63b9df5ed7ffe10ac70025f408d28b3dd260</id>
<content type='text'>
Originally [1], libbpf's (now deprecated) probe functions returned a bool
to acknowledge support but the new APIs return an int with a possible
negative error code to reflect probe failure. This change decides for
bpftool to declare maps and helpers are not available on probe failures.

[1]: https://lore.kernel.org/bpf/20220202225916.3313522-3-andrii@kernel.org/

Signed-off-by: Milan Landaverde &lt;milan@mdaverde.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220504161356.3497972-2-milan@mdaverde.com
</content>
</entry>
<entry>
<title>bpftool, musl compat: Replace sys/fcntl.h by fcntl.h</title>
<updated>2022-04-25T21:24:28+00:00</updated>
<author>
<name>Dominique Martinet</name>
<email>asmadeus@codewreck.org</email>
</author>
<published>2022-04-24T05:10:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=246bdfa52f33ecfa52546ed67287de4eab165b2e'/>
<id>urn:sha1:246bdfa52f33ecfa52546ed67287de4eab165b2e</id>
<content type='text'>
musl does not like including sys/fcntl.h directly:

    [...]
    1 | #warning redirecting incorrect #include &lt;sys/fcntl.h&gt; to &lt;fcntl.h&gt;
    [...]

Signed-off-by: Dominique Martinet &lt;asmadeus@codewreck.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/20220424051022.2619648-5-asmadeus@codewreck.org
</content>
</entry>
<entry>
<title>bpftool, musl compat: Replace nftw with FTW_ACTIONRETVAL</title>
<updated>2022-04-25T21:24:16+00:00</updated>
<author>
<name>Dominique Martinet</name>
<email>asmadeus@codewreck.org</email>
</author>
<published>2022-04-24T05:10:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=93bc2e9e943d20a51473a49009db3243de6e098d'/>
<id>urn:sha1:93bc2e9e943d20a51473a49009db3243de6e098d</id>
<content type='text'>
musl nftw implementation does not support FTW_ACTIONRETVAL. There have been
multiple attempts at pushing the feature in musl upstream, but it has been
refused or ignored all the times:

  https://www.openwall.com/lists/musl/2021/03/26/1
  https://www.openwall.com/lists/musl/2022/01/22/1

In this case we only care about /proc/&lt;pid&gt;/fd/&lt;fd&gt;, so it's not too difficult
to reimplement directly instead, and the new implementation makes 'bpftool perf'
slightly faster because it doesn't needlessly stat/readdir unneeded directories
(54ms -&gt; 13ms on my machine).

Signed-off-by: Dominique Martinet &lt;asmadeus@codewreck.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/20220424051022.2619648-4-asmadeus@codewreck.org
</content>
</entry>
</feed>
