Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bpftool sync 2025-02-25 #182

Merged
merged 9 commits into from
Feb 25, 2025

Conversation

qmonnet
Copy link
Member

@qmonnet qmonnet commented Feb 25, 2025

Pull latest libbpf from mirror and sync bpftool repo with kernel, up to the commits used for libbpf sync. This is an automatic update performed by calling the sync script from this repo:

$ ./scripts/sync-kernel.sh . <path/to/>linux

Leo-Yan and others added 9 commits December 15, 2024 22:12
When the feature libelf-zstd is detected, the zstd lib is required by
libelf.  Link the zstd lib in this case.

Reviewed-by: Quentin Monnet <[email protected]>
Signed-off-by: Leo Yan <[email protected]>
Tested-by: Namhyung Kim <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Eduard Zingerman <[email protected]>
Cc: Guilherme Amadio <[email protected]>
Cc: Hao Luo <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: John Fastabend <[email protected]>
Cc: KP Singh <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Martin KaFai Lau <[email protected]>
Cc: Nick Terrell <[email protected]>
Cc: Song Liu <[email protected]>
Cc: Stanislav Fomichev <[email protected]>
Cc: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
The `readlink(path, buf, sizeof(buf))` call reads at most sizeof(buf)
bytes and *does not* append null-terminator to buf. With respect to
that, fix two pieces in get_fd_type:

1. Change the truncation check to contain sizeof(buf) rather than
   sizeof(path).
2. Append null-terminator to buf.

Reported by Coverity.

Signed-off-by: Viktor Malik <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Reviewed-by: Quentin Monnet <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Explain the meaning of kind_flag in BTF type_tags and decl_tags.
Update uapi btf.h kind_flag comment to reflect the changes.

Signed-off-by: Ihor Solodrai <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Fixed some formatting specifiers errors, such as using %d for int and %u
for unsigned int, as well as other byte-length types.

Signed-off-by: Jiayuan Chen <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Reviewed-by: Quentin Monnet <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Commit 0abff462d802 ("bpf: Add comment about helper freeze") missed the
tooling header sync. Fix it.

Signed-off-by: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
The size of struct bpf_map::name is BPF_OBJ_NAME_LEN (16).

bpf(2) {
  map_create() {
    bpf_obj_name_cpy(map->name, attr->map_name, sizeof(attr->map_name));
  }
}

When specifying a map name using bpftool map create name, no error is
reported if the name length is greater than 15.

    $ sudo bpftool map create /sys/fs/bpf/12345678901234567890 \
        type array key 4 value 4 entries 5 name 12345678901234567890

Users will think that 12345678901234567890 is legal, but this name cannot
be used to index a map.

    $ sudo bpftool map show name 12345678901234567890
    Error: can't parse name

    $ sudo bpftool map show
    ...
    1249: array  name 123456789012345  flags 0x0
    	key 4B  value 4B  max_entries 5  memlock 304B

    $ sudo bpftool map show name 123456789012345
    1249: array  name 123456789012345  flags 0x0
    	key 4B  value 4B  max_entries 5  memlock 304B

The map name provided in the command line is truncated, but no warning is
reported. This submission checks the length of the map name.

Reviewed-by: Quentin Monnet <[email protected]>
Signed-off-by: Rong Tao <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Pull latest libbpf from mirror.
Libbpf version: 1.6.0
Libbpf commit:  42a6ef63161a8dc4288172b27f3870e50b3606f7

Signed-off-by: Quentin Monnet <[email protected]>
Allow the user to configure needed_{head,tail}room for both netkit
devices. The idea is similar to 163e529200af ("veth: implement
ndo_set_rx_headroom") with the difference that the two parameters
can be specified upon device creation. By default the current behavior
stays as is which is needed_{head,tail}room is 0.

In case of Cilium, for example, the netkit devices are not enslaved
into a bridge or openvswitch device (rather, BPF-based redirection
is used out of tcx), and as such these parameters are not propagated
into the Pod's netns via peer device.

Given Cilium can run in vxlan/geneve tunneling mode (needed_headroom)
and/or be used in combination with WireGuard (needed_{head,tail}room),
allow the Cilium CNI plugin to specify these two upon netkit device
creation.

Signed-off-by: Daniel Borkmann <[email protected]>
Reviewed-by: Jakub Kicinski <[email protected]>
Acked-by: Nikolay Aleksandrov <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Syncing latest bpftool commits from kernel repository.
Baseline bpf-next commit:   01f3ce5328c405179b2c69ea047c423dad2bfa6d
Checkpoint bpf-next commit: 239860828f8660e2be487e2fbdae2640cce3fd67
Baseline bpf commit:        c45323b7560ec87c37c729b703c86ee65f136d75
Checkpoint bpf commit:      319fc77f8f45a1b3dba15b0cc1a869778fd222f7

Daniel Borkmann (1):
  netkit: Allow for configuring needed_{head,tail}room

Ihor Solodrai (1):
  docs/bpf: Document the semantics of BTF tags with kind_flag

Jiayuan Chen (1):
  bpftool: Using the right format specifiers

Leo Yan (1):
  bpftool: Link zstd lib required by libelf

Rong Tao (1):
  bpftool: Check map name length when map create

Viktor Malik (1):
  bpftool: Fix readlink usage in get_fd_type

Yonghong Song (1):
  bpf: Sync uapi bpf.h header for the tooling infra

 include/uapi/linux/bpf.h     |  5 ++++-
 include/uapi/linux/btf.h     |  3 ++-
 include/uapi/linux/if_link.h |  2 ++
 src/Makefile                 |  7 +++++++
 src/common.c                 |  3 ++-
 src/gen.c                    | 12 ++++++------
 src/link.c                   | 14 +++++++-------
 src/main.c                   |  8 ++++----
 src/map.c                    | 14 +++++++++-----
 9 files changed, 43 insertions(+), 25 deletions(-)

Signed-off-by: Quentin Monnet <[email protected]>
@qmonnet qmonnet merged commit 3436846 into libbpf:main Feb 25, 2025
6 checks passed
@qmonnet qmonnet deleted the bpftool-sync-2025-02-25T09-51-05.818Z branch February 25, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants