<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/bpf/bpftool/feature.c, branch linux-5.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-05-10T00:16:05Z</updated>
<entry>
<title>bpftool: Output message if no helpers found in feature probing</title>
<updated>2022-05-10T00:16:05Z</updated>
<author>
<name>Milan Landaverde</name>
</author>
<published>2022-05-04T16:13:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.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:05Z</updated>
<author>
<name>Milan Landaverde</name>
</author>
<published>2022-05-04T16:13:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.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: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK</title>
<updated>2022-04-11T03:17:16Z</updated>
<author>
<name>Yafang Shao</name>
</author>
<published>2022-04-09T12:59:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a777e18f1bcd32528ff5dfd10a6629b655b05eb8'/>
<id>urn:sha1:a777e18f1bcd32528ff5dfd10a6629b655b05eb8</id>
<content type='text'>
We have switched to memcg-based memory accouting and thus the rlimit is
not needed any more. LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK was introduced in
libbpf for backward compatibility, so we can use it instead now.

libbpf_set_strict_mode always return 0, so we don't need to check whether
the return value is 0 or not.

Signed-off-by: Yafang Shao &lt;laoar.shao@gmail.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220409125958.92629-4-laoar.shao@gmail.com
</content>
</entry>
<entry>
<title>bpftool: Handle libbpf_probe_prog_type errors</title>
<updated>2022-04-04T21:54:44Z</updated>
<author>
<name>Milan Landaverde</name>
</author>
<published>2022-03-31T15:45:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7b53eaa656c34d5b521e245cbfc3aee2d7b89eac'/>
<id>urn:sha1:7b53eaa656c34d5b521e245cbfc3aee2d7b89eac</id>
<content type='text'>
Previously [1], we were using bpf_probe_prog_type which returned a
bool, but the new libbpf_probe_bpf_prog_type can return a negative
error code on failure. This change decides for bpftool to declare
a program type is not available on probe failure.

[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;
Reviewed-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/20220331154555.422506-4-milan@mdaverde.com
</content>
</entry>
<entry>
<title>bpf/bpftool: Add unprivileged_bpf_disabled check against value of 2</title>
<updated>2022-03-29T02:01:54Z</updated>
<author>
<name>Milan Landaverde</name>
</author>
<published>2022-03-22T14:49:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8c1b21198551d795a44f08ad185f716732b47bbe'/>
<id>urn:sha1:8c1b21198551d795a44f08ad185f716732b47bbe</id>
<content type='text'>
In [1], we added a kconfig knob that can set
/proc/sys/kernel/unprivileged_bpf_disabled to 2

We now check against this value in bpftool feature probe

[1] https://lore.kernel.org/bpf/74ec548079189e4e4dffaeb42b8987bb3c852eee.1620765074.git.daniel@iogearbox.net

Signed-off-by: Milan Landaverde &lt;milan@mdaverde.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Acked-by: KP Singh &lt;kpsingh@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220322145012.1315376-1-milan@mdaverde.com
</content>
</entry>
<entry>
<title>bpftool: Restore support for BPF offload-enabled feature probing</title>
<updated>2022-03-10T15:09:47Z</updated>
<author>
<name>Niklas Söderlund</name>
</author>
<published>2022-03-10T12:18:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f655c088e74f4681134f650b5743174586a61016'/>
<id>urn:sha1:f655c088e74f4681134f650b5743174586a61016</id>
<content type='text'>
Commit 1a56c18e6c2e4e74 ("bpftool: Stop supporting BPF offload-enabled
feature probing") removed the support to probe for BPF offload features.
This is still something that is useful for NFP NIC that can support
offloading of BPF programs.

The reason for the dropped support was that libbpf starting with v1.0
would drop support for passing the ifindex to the BPF prog/map/helper
feature probing APIs. In order to keep this useful feature for NFP
restore the functionality by moving it directly into bpftool.

The code restored is a simplified version of the code that existed in
libbpf which supposed passing the ifindex. The simplification is that it
only targets the cases where ifindex is given and call into libbpf for
the cases where it's not.

Before restoring support for probing offload features:

  # bpftool feature probe dev ens4np0
  Scanning system call availability...
  bpf() syscall is available

  Scanning eBPF program types...

  Scanning eBPF map types...

  Scanning eBPF helper functions...
  eBPF helpers supported for program type sched_cls:
  eBPF helpers supported for program type xdp:

  Scanning miscellaneous eBPF features...
  Large program size limit is NOT available
  Bounded loop support is NOT available
  ISA extension v2 is NOT available
  ISA extension v3 is NOT available

With support for probing offload features restored:

  # bpftool feature probe dev ens4np0
  Scanning system call availability...
  bpf() syscall is available

  Scanning eBPF program types...
  eBPF program_type sched_cls is available
  eBPF program_type xdp is available

  Scanning eBPF map types...
  eBPF map_type hash is available
  eBPF map_type array is available

  Scanning eBPF helper functions...
  eBPF helpers supported for program type sched_cls:
  	- bpf_map_lookup_elem
  	- bpf_get_prandom_u32
  	- bpf_perf_event_output
  eBPF helpers supported for program type xdp:
  	- bpf_map_lookup_elem
  	- bpf_get_prandom_u32
  	- bpf_perf_event_output
  	- bpf_xdp_adjust_head
  	- bpf_xdp_adjust_tail

  Scanning miscellaneous eBPF features...
  Large program size limit is NOT available
  Bounded loop support is NOT available
  ISA extension v2 is NOT available
  ISA extension v3 is NOT available

Signed-off-by: Niklas Söderlund &lt;niklas.soderlund@corigine.com&gt;
Signed-off-by: Simon Horman &lt;simon.horman@corigine.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/20220310121846.921256-1-niklas.soderlund@corigine.com
</content>
</entry>
<entry>
<title>bpftool: Stop supporting BPF offload-enabled feature probing</title>
<updated>2022-02-03T15:32:25Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2022-02-02T22:59:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1a56c18e6c2e4e7482ac9e1a4ffe1770841dd6bd'/>
<id>urn:sha1:1a56c18e6c2e4e7482ac9e1a4ffe1770841dd6bd</id>
<content type='text'>
libbpf 1.0 is not going to support passing ifindex to BPF
prog/map/helper feature probing APIs. Remove the support for BPF offload
feature probing.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/20220202225916.3313522-3-andrii@kernel.org
</content>
</entry>
<entry>
<title>bpftool: Probe for instruction set extensions</title>
<updated>2022-01-05T12:31:40Z</updated>
<author>
<name>Paul Chaignon</name>
</author>
<published>2022-01-04T18:00:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0fd800b2456cf90ed738a1260b53acaa8843b5ae'/>
<id>urn:sha1:0fd800b2456cf90ed738a1260b53acaa8843b5ae</id>
<content type='text'>
This patch introduces new probes to check whether the kernel supports
instruction set extensions v2 and v3. The first introduced eBPF
instructions BPF_J{LT,LE,SLT,SLE} in commit 92b31a9af73b ("bpf: add
BPF_J{LT,LE,SLT,SLE} instructions"). The second introduces 32-bit
variants of all jump instructions in commit 092ed0968bb6 ("bpf:
verifier support JMP32").

These probes are useful for userspace BPF projects that want to use newer
instruction set extensions on newer kernels, to reduce the programs'
sizes or their complexity. LLVM already provides an mcpu=probe option to
automatically probe the kernel and select the newest-supported
instruction set extension. That is however not flexible enough for all
use cases. For example, in Cilium, we only want to use the v3
instruction set extension on v5.10+, even though it is supported on all
kernels v5.1+.

Signed-off-by: Paul Chaignon &lt;paul@isovalent.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/3bfedcd9898c1f41ac67ca61f144fec84c6c3a92.1641314075.git.paul@isovalent.com
</content>
</entry>
<entry>
<title>bpftool: Probe for bounded loop support</title>
<updated>2022-01-05T12:31:40Z</updated>
<author>
<name>Paul Chaignon</name>
</author>
<published>2022-01-04T17:59:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c04fb2b0bd9275969be3b0a95f9c3ef76b1bfb73'/>
<id>urn:sha1:c04fb2b0bd9275969be3b0a95f9c3ef76b1bfb73</id>
<content type='text'>
This patch introduces a new probe to check whether the verifier supports
bounded loops as introduced in commit 2589726d12a1 ("bpf: introduce
bounded loops"). This patch will allow BPF users such as Cilium to probe
for loop support on startup and only unconditionally unroll loops on
older kernels.

The results are displayed as part of the miscellaneous section, as shown
below.

  $ bpftool feature probe | grep loops
  Bounded loop support is available
  $ bpftool feature probe macro | grep LOOPS
  #define HAVE_BOUNDED_LOOPS
  $ bpftool feature probe -j | jq .misc
  {
    "have_large_insn_limit": true,
    "have_bounded_loops": true
  }

Signed-off-by: Paul Chaignon &lt;paul@isovalent.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/f7807c0b27d79f48e71de7b5a99c680ca4bd0151.1641314075.git.paul@isovalent.com
</content>
</entry>
<entry>
<title>bpftool: Refactor misc. feature probe</title>
<updated>2022-01-05T12:31:40Z</updated>
<author>
<name>Paul Chaignon</name>
</author>
<published>2022-01-04T17:59:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b22bf1b9979a608827dea98c61ed9ec297bcc513'/>
<id>urn:sha1:b22bf1b9979a608827dea98c61ed9ec297bcc513</id>
<content type='text'>
There is currently a single miscellaneous feature probe,
HAVE_LARGE_INSN_LIMIT, to check for the 1M instructions limit in the
verifier. Subsequent patches will add additional miscellaneous probes,
which follow the same pattern at the existing probe. This patch
therefore refactors the probe to avoid code duplication in subsequent
patches.

The BPF program type and the checked error numbers in the
HAVE_LARGE_INSN_LIMIT probe are changed to better generalize to other
probes. The feature probe retains its current behavior despite those
changes.

Signed-off-by: Paul Chaignon &lt;paul@isovalent.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/956c9329a932c75941194f91790d01f31dfbe01b.1641314075.git.paul@isovalent.com
</content>
</entry>
</feed>
