mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suraj Jitindar Singh <surajjs@amazon.com>
To: <stable@vger.kernel.org>
Cc: <gregkh@linuxfoundation.org>, <chenyichong@uniontech.com>,
	<andrii@kernel.org>, <bpf@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <regressions@lists.linux.dev>
Subject: [REGRESSION] 5.15.221 & 6.1.188: bpftool: redefinition of 'free_btf_vmlinux'
Date: Tue, 15 Sep 2026 23:58:34 +0000	[thread overview]
Message-ID: <20260915235834.20559-1-surajjs@amazon.com> (raw)

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

             reply	other threads:[~2026-09-15 23:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 23:58 Suraj Jitindar Singh [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260915235834.20559-1-surajjs@amazon.com \
    --to=surajjs@amazon.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenyichong@uniontech.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=regressions@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®