Skip to content

Bpftool sync 2026-07-02#271

Merged
qmonnet merged 6 commits into
libbpf:mainfrom
qmonnet:bpftool-sync-2026-07-02T14-49-15.566Z
Jul 2, 2026
Merged

Bpftool sync 2026-07-02#271
qmonnet merged 6 commits into
libbpf:mainfrom
qmonnet:bpftool-sync-2026-07-02T14-49-15.566Z

Conversation

@qmonnet

@qmonnet qmonnet commented Jul 2, 2026

Copy link
Copy Markdown
Member

Sync bpftool repo with kernel. This is an automatic update performed by calling the sync script from this repo:

$ BPF_NEXT_TIP_COMMIT=0b58988cacfc91604c4b5be2c3295f8aac0ee3d0 ./scripts/sync-kernel.sh . <path/to/>linux

Setting a manual bpf-next tip to sync the -Wformat* flags fix from Andrii without waiting for the next libbpf update.

chenyichong1 and others added 6 commits June 24, 2026 10:50
struct_ops frees the global btf_vmlinux object.

In batch mode, a later struct_ops command can reuse stale state.

Reset the BTF pointer and cached map info state.

Fixes: 65c93628599d ("bpftool: Add struct_ops support")
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://lore.kernel.org/bpf/9F9017160ABE125F+20260624025055.1574875-3-chenyichong@uniontech.com
Adding BPF_OBJ_GET_INFO_BY_FD support for tracing_multi links.

We expose following tracing_multi link data:
- attach_type of the program
- number of ids
- array of BTF ids
- array of its related kernel addresses
- array of cookies

The change follows the kprobe_multi and uprobe_multi link-info convention
of optional output arrays with an in/out count,

On top of standard tracing link data we also expose addresses, because they
are useful info for user (especially when the attachment was done via pattern).
This data is hidden when kallsyms does not allow exposing kernel pointer values.

Assisted-by: Codex:GPT-5

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Leon Hwang <leon.hwang@linux.dev>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260629212208.895962-2-jolsa@kernel.org
Adding bpftool support to show tracing_multi link details,
the new output looks like:

  # bpftool link
  ...
  61: tracing_multi  prog 167
          attach_type trace_fentry_multi  btf_obj_id 1  count 3
          btf_id           addr             cookie           func [module]
          92598            ffffffff825017c4 10               bpf_fentry_test1
          92600            ffffffff82503814 30               bpf_fentry_test2
          92601            ffffffff82503824 20               bpf_fentry_test3
          pids test_progs(1540)

Assisted-by: Codex:GPT-5

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260629212208.895962-4-jolsa@kernel.org
Commit 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
started building the bootstrap libbpf with HOST_CFLAGS, stripping the
warning options that are unsuitable for that build by filtering out
-W -Wall -Wextra -Wformat -Wformat-signedness.

HOST_CFLAGS inherits EXTRA_WARNINGS, which includes -Wformat-security
and -Wformat-y2k. The filter drops -Wall and -Wformat (the latter being
what actually enables -Wformat), but leaves those two -Wformat-* children
in LIBBPF_BOOTSTRAP_CFLAGS. Building the bootstrap libbpf with it then
warns:

  cc1: warning: '-Wformat-y2k' ignored without '-Wformat'
  cc1: warning: '-Wformat-security' ignored without '-Wformat'

The warning is easy to miss in an in-tree build: tools/lib/bpf/Makefile
re-adds -Wall via "override CFLAGS += -Wall", which re-enables -Wformat
for the libbpf objects, so only libbpf's feature-detection probe (which
uses the passed CFLAGS verbatim) leaks the two warnings. The standalone
libbpf Makefile (github.com/libbpf/libbpf, used by the bpftool mirror)
instead uses "CFLAGS ?= ... -Wall", which the passed-in CFLAGS overrides,
so -Wall is never re-added and every bootstrap object warns.

Use a -Wformat% wildcard in the filter-out so the orphaned children are
removed together with the parent.

Fixes: 9080b97689db ("bpftool: Pass host flags to bootstrap libbpf")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/bpf/20260630205418.3483969-1-andrii@kernel.org
get_map_kv_btf() caches the vmlinux BTF object when a map uses
btf_vmlinux_value_type_id. map dump released that object when the
command completed, but left the global pointer stale.

The same cached object can also be returned to print_key_value(), which
freed it directly. That leaves btf_vmlinux dangling before the command
cleanup path runs.

Use free_map_kv_btf() for per-entry cleanup, and reset the cached
btf_vmlinux pointer when the map command releases the object. This keeps
batch mode from reusing a freed BTF object.

Fixes: 4e1ea33292ff ("bpftool: Support dumping a map with btf_vmlinux_value_type_id")
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://lore.kernel.org/bpf/9072F43B3F74DF91+20260624025055.1574875-2-chenyichong@uniontech.com
Syncing latest bpftool commits from kernel repository.
Baseline bpf-next commit:   53435562a725962e4de0c29653223129ba11643a
Checkpoint bpf-next commit: 0b58988cacfc91604c4b5be2c3295f8aac0ee3d0
Baseline bpf commit:        9b51a6155d14389876916726430da30eabb1d4ed
Checkpoint bpf commit:      9b51a6155d14389876916726430da30eabb1d4ed

Andrii Nakryiko (1):
  bpftool: Strip all -Wformat* flags from bootstrap libbpf build

Jiri Olsa (2):
  bpf: Add tracing_multi link info support
  bpftool: Add tracing_multi link info output

Yichong Chen (2):
  tools/bpf/bpftool: Reset vmlinux BTF after map commands
  tools/bpf/bpftool: Reset vmlinux BTF after struct_ops commands

 include/uapi/linux/bpf.h |   9 +++
 src/Makefile             |   2 +-
 src/link.c               | 133 +++++++++++++++++++++++++++++++++++++++
 src/map.c                |  12 +++-
 src/struct_ops.c         |   4 ++
 5 files changed, 156 insertions(+), 4 deletions(-)

Signed-off-by: Quentin Monnet <qmo@kernel.org>
@qmonnet qmonnet merged commit ad62711 into libbpf:main Jul 2, 2026
6 of 7 checks passed
@qmonnet qmonnet deleted the bpftool-sync-2026-07-02T14-49-15.566Z branch July 2, 2026 14:56
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.

4 participants