* [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
* [PATCH 6.1.y] bpftool: remove duplicate free_btf_vmlinux() definition
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 ` Suraj Jitindar Singh
2026-09-16 0:27 ` [PATCH 5.15.y] " Suraj Jitindar Singh
1 sibling, 0 replies; 3+ messages in thread
From: Suraj Jitindar Singh @ 2026-09-16 0:27 UTC (permalink / raw)
To: stable; +Cc: gregkh, chenyichong, andrii, bpf, linux-kernel
v6.1.188 backported
660a19e46942 ("tools/bpf/bpftool: Reset vmlinux BTF after map commands")
[ upstream commit 66d7e39e49b0 ]
which re-adds free_btf_vmlinux(). However, the prerequisite cleanup
52df1a8aabad ("bpftool: remove function free_btf_vmlinux()")
was never backported to 6.1.y, so the tree still carried the original
free_btf_vmlinux() definition. The backport therefore produced two
identical-signature static definitions in tools/bpf/bpftool/map.c and
the build fails:
map.c: error: redefinition of 'free_btf_vmlinux'
Remove the stale pre-existing definition, keeping the one reintroduced
by 660a19e46942 (which also resets btf_vmlinux = NULL). This matches the
current mainline end state.
Fixes: 660a19e46942 ("tools/bpf/bpftool: Reset vmlinux BTF after map commands")
Signed-off-by: Suraj Jitindar Singh <surajjs@amazon.com>
---
This is a stable-only fix. Mainline is not affected: 52df1a8aabad
("bpftool: remove function free_btf_vmlinux()") removed the original
definition, and 66d7e39e49b0 later re-added a single one. The duplicate
exists only in the 5.15.y and 6.1.y trees, which received the backport
of 66d7e39e49b0 without the prerequisite 52df1a8aabad. There is
therefore no single upstream commit to cite; the fix restores the
mainline end state.
tools/bpf/bpftool/map.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index a77bf45d6f83..748b3def6b2c 100644
--- 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,
bool show_header)
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 5.15.y] bpftool: remove duplicate free_btf_vmlinux() definition
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 ` Suraj Jitindar Singh
1 sibling, 0 replies; 3+ messages in thread
From: Suraj Jitindar Singh @ 2026-09-16 0:27 UTC (permalink / raw)
To: stable; +Cc: gregkh, chenyichong, andrii, bpf, linux-kernel
v5.15.221 backported
a9e2496111aa ("tools/bpf/bpftool: Reset vmlinux BTF after map commands")
[ upstream commit 66d7e39e49b0 ]
which re-adds free_btf_vmlinux(). However, the prerequisite cleanup
52df1a8aabad ("bpftool: remove function free_btf_vmlinux()")
was never backported to 5.15.y, so the tree still carried the original
free_btf_vmlinux() definition. The backport therefore produced two
identical-signature static definitions in tools/bpf/bpftool/map.c and
the build fails:
map.c: error: redefinition of 'free_btf_vmlinux'
Remove the stale pre-existing definition, keeping the one reintroduced
by a9e2496111aa (which also resets btf_vmlinux = NULL). This matches the
current mainline end state.
Fixes: a9e2496111aa ("tools/bpf/bpftool: Reset vmlinux BTF after map commands")
Signed-off-by: Suraj Jitindar Singh <surajjs@amazon.com>
---
This is a stable-only fix. Mainline is not affected: 52df1a8aabad
("bpftool: remove function free_btf_vmlinux()") removed the original
definition, and 66d7e39e49b0 later re-added a single one. The duplicate
exists only in the 5.15.y and 6.1.y trees, which received the backport
of 66d7e39e49b0 without the prerequisite 52df1a8aabad. There is
therefore no single upstream commit to cite; the fix restores the
mainline end state.
tools/bpf/bpftool/map.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index cf257da20195..54d855ac5408 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -828,12 +828,6 @@ static void free_map_kv_btf(struct btf *btf)
btf__free(btf);
}
-static void free_btf_vmlinux(void)
-{
- if (!libbpf_get_error(btf_vmlinux))
- btf__free(btf_vmlinux);
-}
-
static int
map_dump(int fd, struct bpf_map_info *info, json_writer_t *wtr,
bool show_header)
--
2.47.3
^ 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®