<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-linux/tools/bpf/bpftool, branch jd/bump-compilers</title>
<subtitle>WireGuard for the Linux kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-linux/atom/tools/bpf/bpftool?h=jd%2Fbump-compilers</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-linux/atom/tools/bpf/bpftool?h=jd%2Fbump-compilers'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/'/>
<updated>2024-07-17T20:45:58Z</updated>
<entry>
<title>bpftool: Fix typo in usage help</title>
<updated>2024-07-17T20:45:58Z</updated>
<author>
<name>Donald Hunter</name>
<email>donald.hunter@gmail.com</email>
</author>
<published>2024-07-17T13:45:08Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=3c870059e9f8897c032f4256f90c41ee822218a8'/>
<id>urn:sha1:3c870059e9f8897c032f4256f90c41ee822218a8</id>
<content type='text'>
The usage help for "bpftool prog help" contains a ° instead of the _
symbol for cgroup/sendmsg_unix. Fix the typo.

Fixes: 8b3cba987e6d ("bpftool: Add support for cgroup unix socket address hooks")
Signed-off-by: Donald Hunter &lt;donald.hunter@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Quentin Monnet &lt;qmo@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20240717134508.77488-1-donald.hunter@gmail.com
</content>
</entry>
<entry>
<title>bpftool: improve skeleton backwards compat with old buggy libbpfs</title>
<updated>2024-07-10T02:03:05Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2024-07-08T20:45:38Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=06e71ad534881d2a09ced7509d2ab0daedac4c96'/>
<id>urn:sha1:06e71ad534881d2a09ced7509d2ab0daedac4c96</id>
<content type='text'>
Old versions of libbpf don't handle varying sizes of bpf_map_skeleton
struct correctly. As such, BPF skeleton generated by newest bpftool
might not be compatible with older libbpf (though only when libbpf is
used as a shared library), even though it, by design, should.

Going forward libbpf will be fixed, plus we'll release bug fixed
versions of relevant old libbpfs, but meanwhile try to mitigate from
bpftool side by conservatively assuming older and smaller definition of
bpf_map_skeleton, if possible. Meaning, if there are no struct_ops maps.

If there are struct_ops, then presumably user would like to have
auto-attaching logic and struct_ops map link placeholders, so use the
full bpf_map_skeleton definition in that case.

Acked-by: Quentin Monnet &lt;qmo@kernel.org&gt;
Co-developed-by: Mykyta Yatsenko &lt;yatsenko@meta.com&gt;
Signed-off-by: Mykyta Yatsenko &lt;yatsenko@meta.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Link: https://lore.kernel.org/r/20240708204540.4188946-2-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpftool: Mount bpffs when pinmaps path not under the bpffs</title>
<updated>2024-07-02T16:20:32Z</updated>
<author>
<name>Tao Chen</name>
<email>chen.dylane@gmail.com</email>
</author>
<published>2024-07-02T13:11:50Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=da5f8fd1f0d393d5eaaba9ad8c22d1c26bb2bf9b'/>
<id>urn:sha1:da5f8fd1f0d393d5eaaba9ad8c22d1c26bb2bf9b</id>
<content type='text'>
As Quentin said [0], BPF map pinning will fail if the pinmaps path is not
under the bpffs, like:

  libbpf: specified path /home/ubuntu/test/sock_ops_map is not on BPF FS
  Error: failed to pin all maps

  [0] https://github.com/libbpf/bpftool/issues/146

Fixes: 3767a94b3253 ("bpftool: add pinmaps argument to the load/loadall")
Signed-off-by: Tao Chen &lt;chen.dylane@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Tested-by: Quentin Monnet &lt;qmo@kernel.org&gt;
Reviewed-by: Quentin Monnet &lt;qmo@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20240702131150.15622-1-chen.dylane@gmail.com
</content>
</entry>
<entry>
<title>bpftool: Allow compile-time checks of BPF map auto-attach support in skeleton</title>
<updated>2024-06-21T17:53:09Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2024-06-18T18:38:32Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=651337c7ca82c259bf5c8fe9beda9673531a0031'/>
<id>urn:sha1:651337c7ca82c259bf5c8fe9beda9673531a0031</id>
<content type='text'>
New versions of bpftool now emit additional link placeholders for BPF
maps (struct_ops maps are the only maps right now that support
attachment), and set up BPF skeleton in such a way that libbpf will
auto-attach BPF maps automatically, assumming libbpf is recent enough
(v1.5+). Old libbpf will do nothing with those links and won't attempt
to auto-attach maps. This allows user code to handle both pre-v1.5 and
v1.5+ versions of libbpf at runtime, if necessary.

But if users don't have (or don't want to) control bpftool version that
generates skeleton, then they can't just assume that skeleton will have
link placeholders. To make this detection possible and easy, let's add
the following to generated skeleton header file:

  #define BPF_SKEL_SUPPORTS_MAP_AUTO_ATTACH 1

This can be used during compilation time to guard code that accesses
skel-&gt;links.&lt;map&gt; slots.

Note, if auto-attachment is undesirable, libbpf allows to disable this
through bpf_map__set_autoattach(map, false). This is necessary only on
libbpf v1.5+, older libbpf doesn't support map auto-attach anyways.

Libbpf version can be detected at compilation time using
LIBBPF_MAJOR_VERSION and LIBBPF_MINOR_VERSION macros, or at runtime with
libbpf_major_version() and libbpf_minor_version() APIs.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Quentin Monnet &lt;qmo@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20240618183832.2535876-1-andrii@kernel.org
</content>
</entry>
<entry>
<title>bpftool: Support dumping kfunc prototypes from BTF</title>
<updated>2024-06-12T18:01:32Z</updated>
<author>
<name>Daniel Xu</name>
<email>dxu@dxuuu.xyz</email>
</author>
<published>2024-06-12T15:58:36Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=770abbb5a25a5b767f1c60ba366aea503728e957'/>
<id>urn:sha1:770abbb5a25a5b767f1c60ba366aea503728e957</id>
<content type='text'>
This patch enables dumping kfunc prototypes from bpftool. This is useful
b/c with this patch, end users will no longer have to manually define
kfunc prototypes. For the kernel tree, this also means we can optionally
drop kfunc prototypes from:

        tools/testing/selftests/bpf/bpf_kfuncs.h
        tools/testing/selftests/bpf/bpf_experimental.h

Example usage:

        $ make PAHOLE=/home/dxu/dev/pahole/build/pahole -j30 vmlinux

        $ ./tools/bpf/bpftool/bpftool btf dump file ./vmlinux format c | rg "__ksym;" | head -3
        extern void cgroup_rstat_updated(struct cgroup *cgrp, int cpu) __weak __ksym;
        extern void cgroup_rstat_flush(struct cgroup *cgrp) __weak __ksym;
        extern struct bpf_key *bpf_lookup_user_key(u32 serial, u64 flags) __weak __ksym;

Signed-off-by: Daniel Xu &lt;dxu@dxuuu.xyz&gt;
Link: https://lore.kernel.org/r/bf6c08f9263c4bd9d10a717de95199d766a13f61.1718207789.git.dxu@dxuuu.xyz
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpftool: Query only cgroup-related attach types</title>
<updated>2024-06-11T18:39:09Z</updated>
<author>
<name>Kenta Tada</name>
<email>tadakentaso@gmail.com</email>
</author>
<published>2024-06-07T11:17:04Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=98b303c9bf05dae932efbd71e18d81f6c64f20d8'/>
<id>urn:sha1:98b303c9bf05dae932efbd71e18d81f6c64f20d8</id>
<content type='text'>
When CONFIG_NETKIT=y,
bpftool-cgroup shows error even if the cgroup's path is correct:

$ bpftool cgroup tree /sys/fs/cgroup
CgroupPath
ID       AttachType      AttachFlags     Name
Error: can't query bpf programs attached to /sys/fs/cgroup: No such device or address

&gt;From strace and kernel tracing, I found netkit returned ENXIO and this command failed.
I think this AttachType(BPF_NETKIT_PRIMARY) is not relevant to cgroup.

bpftool-cgroup should query just only cgroup-related attach types.

v2-&gt;v3:
  - removed an unnecessary check

v1-&gt;v2:
  - used an array of cgroup attach types

Signed-off-by: Kenta Tada &lt;tadakentaso@gmail.com&gt;
Reviewed-by: Quentin Monnet &lt;qmo@kernel.org&gt;
Link: https://lore.kernel.org/r/20240607111704.6716-1-tadakentaso@gmail.com
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: Auto-attach struct_ops BPF maps in BPF skeleton</title>
<updated>2024-06-06T17:06:05Z</updated>
<author>
<name>Mykyta Yatsenko</name>
<email>yatsenko@meta.com</email>
</author>
<published>2024-06-05T17:51:35Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=08ac454e258e38813afb906650f19acce3afd982'/>
<id>urn:sha1:08ac454e258e38813afb906650f19acce3afd982</id>
<content type='text'>
Similarly to `bpf_program`, support `bpf_map` automatic attachment in
`bpf_object__attach_skeleton`. Currently only struct_ops maps could be
attached.

On bpftool side, code-generate links in skeleton struct for struct_ops maps.
Similarly to `bpf_program_skeleton`, set links in `bpf_map_skeleton`.

On libbpf side, extend `bpf_map` with new `autoattach` field to support
enabling or disabling autoattach functionality, introducing
getter/setter for this field.

`bpf_object__(attach|detach)_skeleton` is extended with
attaching/detaching struct_ops maps logic.

Signed-off-by: Mykyta Yatsenko &lt;yatsenko@meta.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20240605175135.117127-1-yatsenko@meta.com
</content>
</entry>
<entry>
<title>bpftool: Use BTF field iterator in btfgen</title>
<updated>2024-06-05T14:54:41Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2024-06-05T00:16:28Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=e1a8630291fde2a0edac2955e3df48587dac9906'/>
<id>urn:sha1:e1a8630291fde2a0edac2955e3df48587dac9906</id>
<content type='text'>
Switch bpftool's code which is using libbpf-internal
btf_type_visit_type_ids() helper to new btf_field_iter functionality.

This makes bpftool code simpler, but also unblocks removing libbpf's
btf_type_visit_type_ids() helper completely.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Tested-by: Alan Maguire &lt;alan.maguire@oracle.com&gt;
Reviewed-by: Quentin Monnet &lt;qmo@kernel.org&gt;
Acked-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Acked-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20240605001629.4061937-5-andrii@kernel.org
</content>
</entry>
<entry>
<title>bpftool: Fix typo in MAX_NUM_METRICS macro name</title>
<updated>2024-06-03T14:58:27Z</updated>
<author>
<name>Swan Beaujard</name>
<email>beaujardswan@gmail.com</email>
</author>
<published>2024-06-02T22:58:12Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=ce5249b91e34d81255c00950d415ebd4c3cae8d4'/>
<id>urn:sha1:ce5249b91e34d81255c00950d415ebd4c3cae8d4</id>
<content type='text'>
Correct typo in bpftool profiler and change all instances of 'MATRICS' to
'METRICS' in the profiler.bpf.c file.

Signed-off-by: Swan Beaujard &lt;beaujardswan@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Quentin Monnet &lt;qmo@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20240602225812.81171-1-beaujardswan@gmail.com
</content>
</entry>
<entry>
<title>bpftool: Change pid_iter.bpf.c to comply with the change of bpf_link_fops.</title>
<updated>2024-05-30T22:34:14Z</updated>
<author>
<name>Kui-Feng Lee</name>
<email>thinker.li@gmail.com</email>
</author>
<published>2024-05-30T06:59:46Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=d14c1fac0c9722c4ec79589921c9e798601ca9d5'/>
<id>urn:sha1:d14c1fac0c9722c4ec79589921c9e798601ca9d5</id>
<content type='text'>
To support epoll, a new instance of file_operations, bpf_link_fops_poll,
has been added for links that support epoll. The pid_iter.bpf.c checks
f_ops for links and other BPF objects. The check should fail for struct_ops
links without this patch.

Acked-by: Quentin Monnet &lt;qmo@kernel.org&gt;
Signed-off-by: Kui-Feng Lee &lt;thinker.li@gmail.com&gt;
Link: https://lore.kernel.org/r/20240530065946.979330-9-thinker.li@gmail.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
</feed>
