mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [REGRESSION] 5.15.221 & 6.1.188: bpftool: redefinition of 'free_btf_vmlinux'
@ 2026-09-15 23:58 Suraj Jitindar Singh
  2026-09-16  0:27 ` [PATCH 6.1.y] bpftool: remove duplicate free_btf_vmlinux() definition Suraj Jitindar Singh
  2026-09-16  0:27 ` [PATCH 5.15.y] " Suraj Jitindar Singh
  0 siblings, 2 replies; 3+ messages in thread
From: Suraj Jitindar Singh @ 2026-09-15 23:58 UTC (permalink / raw)
  To: stable; +Cc: gregkh, chenyichong, andrii, bpf, linux-kernel, regressions

Hi Greg, all,

Building bpftool from the v6.1.188 and v5.15.221 stable tags fails with a
duplicate function definition:

  tools/bpf/bpftool/map.c: error: redefinition of 'free_btf_vmlinux'
  note: previous definition of 'free_btf_vmlinux' was here

This is a stable-only regression caused by a bad backport (the fix is
correct in mainline). It affects only the current head of each series:

  Tree     Broken      Last good
  5.15.y   v5.15.221   v5.15.220
  6.1.y    v6.1.188    v6.1.187

6.6.y, 6.12.y, 6.18.y and 7.2.y are NOT affected -- those trees already
carried free_btf_vmlinux() in its current (btf_vmlinux = NULL) form
before this cycle, so the backport deduplicated cleanly there.

Root cause
----------
In 6.1.y the backport of

  660a19e46942 ("tools/bpf/bpftool: Reset vmlinux BTF after map commands")
  [mainline 66d7e39e49b0]

*adds* a free_btf_vmlinux() definition. But 6.1.y still carried the older
definition that mainline had already removed, so the result is two
identical-signature static definitions in map.c and the build breaks.

The same happens in 5.15.221, where two commits applied in the same
release collide:

  a9e2496111aa ("tools/bpf/bpftool: Reset vmlinux BTF after map commands")
  44f58f0c5202 ("bpftool: Use libbpf_get_error() to check error")

the latter keeping the old guarded form (if (!libbpf_get_error(...)))
while the former adds the new form.

Reproducer (no kernel build / .config needed)
---------------------------------------------
  git checkout v6.1.188   # or v5.15.221
  gcc -fsyntax-only tools/bpf/bpftool/map.c \
      -Itools/bpf/bpftool -Itools/include -Itools/include/uapi \
      -Itools/lib -Itools/bpf/bpftool/../../include

  => map.c: error: redefinition of 'free_btf_vmlinux'

Suggested fix
-------------
Drop the stale pre-existing definition and keep the one introduced by the
backport (which also resets btf_vmlinux = NULL, matching mainline
66d7e39e49b0). For 6.1.y:

  --- a/tools/bpf/bpftool/map.c
  +++ b/tools/bpf/bpftool/map.c
  @@ -817,11 +817,6 @@ static void free_map_kv_btf(struct btf *btf)
   		btf__free(btf);
   }

  -static void free_btf_vmlinux(void)
  -{
  -	btf__free(btf_vmlinux);
  -}
  -
   static int
   map_dump(int fd, struct bpf_map_info *info, json_writer_t *wtr,

For 5.15.y the same fix applies -- remove the older
libbpf_get_error()-guarded free_btf_vmlinux() definition, keeping the
one that resets btf_vmlinux = NULL.

Happy to send this as a formal patch per-tree if you prefer.

#regzbot introduced: 660a19e46942

Thanks,
Suraj

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-16  0:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 23:58 [REGRESSION] 5.15.221 & 6.1.188: bpftool: redefinition of 'free_btf_vmlinux' Suraj Jitindar Singh
2026-09-16  0:27 ` [PATCH 6.1.y] bpftool: remove duplicate free_btf_vmlinux() definition Suraj Jitindar Singh
2026-09-16  0:27 ` [PATCH 5.15.y] " Suraj Jitindar Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®