All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: zhidao su <soolaugust@gmail.com>,
	bpf@vger.kernel.org, linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, ast@kernel.org,
	daniel@iogearbox.net, andrii@kernel.org, corbet@lwn.net,
	nathan@kernel.org, zhidao su <suzhidao@xiaomi.com>
Subject: Re: [PATCH] kbuild: fix decl_tag_kfuncs gating to require pahole v1.27
Date: Fri, 27 Mar 2026 09:53:00 -0700	[thread overview]
Message-ID: <f362d898-d999-43a4-a07c-4d32a5078809@linux.dev> (raw)
In-Reply-To: <20260327002433.4138813-1-suzhidao@xiaomi.com>

On 3/26/26 5:24 PM, zhidao su wrote:
> decl_tag_kfuncs was implemented in pahole v1.27 (dwarves commit
> 72e88f29c6f7 [1]).  However, ebb79e96f1ea ("kbuild: bpf: Tell pahole
> to DECL_TAG kfuncs") appended it to the list of --btf_features flags
> already gated on pahole >= 1.26, making it silently inactive on any
> pahole v1.26 build.
> 
> Without decl_tag_kfuncs, pahole does not emit DECL_TAG BTF entries for
> __bpf_kfunc-annotated functions.  resolve_btfids then skips
> process_kfunc_with_implicit_args(), so KF_IMPLICIT_ARGS kfuncs keep
> their full prototype (including the implicit aux parameter) in vmlinux
> BTF.  BPF programs loading such kfuncs as weak ksyms fail with:
> 
>   libbpf: extern (func ksym) 'scx_bpf_create_dsq': func_proto [N]
>           incompatible with vmlinux [M]
> 
> Fix by splitting decl_tag_kfuncs into its own >= 127 line in
> Makefile.btf.  Add a PAHOLE_HAS_DECL_TAG_KFUNCS Kconfig symbol so
> build rules can gate on this feature explicitly.  Update
> Documentation/process/changes.rst to reflect the corrected minimum
> pahole version for KF_IMPLICIT_ARGS support.
> 
> [1] https://github.com/acmel/dwarves/commit/72e88f29c6f7e14201756e65bd66157427a61aaf
> 
> Fixes: ebb79e96f1ea ("kbuild: bpf: Tell pahole to DECL_TAG kfuncs")
> Reported-by: Ihor Solodrai <ihor.solodrai@linux.dev>
> Closes: https://lore.kernel.org/bpf/e0ca748d-3204-4160-b37d-0f76cbac8c6c@linux.dev/

No. Please read the feedback behind this link carefully and check the
patch bumping to v1.22 before submitting a new version.

Hint: you can feed it to your "AI agent" too, it should be able to
figure it out.

We don't need a new kconfig flag to enforce higher minimum pahole version.

pw-bot: cr

> Signed-off-by: zhidao su <suzhidao@xiaomi.com>
> ---
>  Documentation/process/changes.rst |  4 ++--
>  lib/Kconfig.debug                 | 10 ++++++++++
>  scripts/Makefile.btf              |  6 +++++-
>  3 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst
> index 02068d72a101..bfe98e38c9c0 100644
> --- a/Documentation/process/changes.rst
> +++ b/Documentation/process/changes.rst
> @@ -38,7 +38,7 @@ bash                   4.2              bash --version
>  binutils               2.30             ld -v
>  flex                   2.5.35           flex --version
>  bison                  2.0              bison --version
> -pahole                 1.26             pahole --version
> +pahole                 1.27             pahole --version
>  util-linux             2.10o            mount --version
>  kmod                   13               depmod -V
>  e2fsprogs              1.41.4           e2fsck -V
> @@ -145,7 +145,7 @@ Since Linux 5.2, if CONFIG_DEBUG_INFO_BTF is selected, the build system
>  generates BTF (BPF Type Format) from DWARF in vmlinux, a bit later from kernel
>  modules as well.  This requires pahole v1.22 or later.
>  
> -Since Linux 7.0, kfuncs annotated with KF_IMPLICIT_ARGS require pahole v1.26
> +Since Linux 7.0, kfuncs annotated with KF_IMPLICIT_ARGS require pahole v1.27
>  or later.  Without it, such kfuncs will have incorrect BTF prototypes in
>  vmlinux, causing BPF programs to fail to load with a "func_proto incompatible
>  with vmlinux" error.  Many sched_ext kfuncs are affected.
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 93f356d2b3d9..38ef8b6ce98d 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -425,6 +425,16 @@ config PAHOLE_HAS_LANG_EXCLUDE
>  	  otherwise it would emit malformed kernel and module binaries when
>  	  using DEBUG_INFO_BTF_MODULES.
>  
> +config PAHOLE_HAS_DECL_TAG_KFUNCS
> +	def_bool PAHOLE_VERSION >= 127
> +	help
> +	  Support for the decl_tag_kfuncs BTF feature, which is required for
> +	  kfuncs annotated with KF_IMPLICIT_ARGS to receive correct BTF
> +	  prototypes.  Without it, such kfuncs retain their full prototype
> +	  (including the implicit aux parameter) in vmlinux BTF, causing BPF
> +	  programs to fail to load with a "func_proto incompatible" error.
> +	  Implemented in pahole v1.27 (commit 72e88f29c).
> +
>  config DEBUG_INFO_BTF_MODULES
>  	bool "Generate BTF type information for kernel modules"
>  	default y
> diff --git a/scripts/Makefile.btf b/scripts/Makefile.btf
> index 562a04b40e06..c804643c5040 100644
> --- a/scripts/Makefile.btf
> +++ b/scripts/Makefile.btf
> @@ -14,7 +14,11 @@ pahole-flags-$(call test-ge, $(pahole-ver), 125)	+= --skip_encoding_btf_inconsis
>  else
>  
>  # Switch to using --btf_features for v1.26 and later.
> -pahole-flags-$(call test-ge, $(pahole-ver), 126)  = -j$(JOBS) --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs
> +pahole-flags-$(call test-ge, $(pahole-ver), 126)  = -j$(JOBS) --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func
> +
> +# decl_tag_kfuncs was implemented in pahole v1.27 (commit 72e88f29c).
> +# It was incorrectly gated on >= 126 by ebb79e96f1ea.
> +pahole-flags-$(call test-ge, $(pahole-ver), 127) += --btf_features=decl_tag_kfuncs
>  
>  pahole-flags-$(call test-ge, $(pahole-ver), 130) += --btf_features=attributes
>  


      reply	other threads:[~2026-03-27 16:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27  0:24 [PATCH] kbuild: fix decl_tag_kfuncs gating to require pahole v1.27 zhidao su
2026-03-27 16:53 ` Ihor Solodrai [this message]

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=f362d898-d999-43a4-a07c-4d32a5078809@linux.dev \
    --to=ihor.solodrai@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=daniel@iogearbox.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=soolaugust@gmail.com \
    --cc=suzhidao@xiaomi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.