From nobody Thu Apr 2 18:53:50 2026 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31F3F1A23A0 for ; Fri, 27 Mar 2026 00:24:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774571081; cv=none; b=OJ6M8WaxhPkET7izGIu5+dVF9kZMMtplUzLjsk3tek0TrbJYc6xWm6n/b1Id2X8goOdRXbWEXn+LzdMfsE2etYmfqiLAiPUEE5N8XEih0rwxcyeZ8wWpkR8U+v/5K4xz+ZcFe3erTxcelpfDnGPaF1KTNnqQbKKH45oF6KW4XcI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774571081; c=relaxed/simple; bh=ivzse+/nAXb7ib7teE4Nq/4iaSLxuqNcf6yPItUPve4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FFwU5IQ1m6cdu0Z+m0er5Sdr+fiZ9SPCaxRNKMN9U+lS9OoRbeqcBYbTUrbKdD49HuLyDCTQHxGZJdFoJCil5dqQyi/4LDWdwSfmzpA7LK/6ee+PhgQgpThyTJCJe58CL1aoM5ShHCLgnQpDlhprvctIN+r2fQUUPspzCJFclfM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LYp9d/xu; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LYp9d/xu" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2ab232cc803so7015165ad.3 for ; Thu, 26 Mar 2026 17:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774571079; x=1775175879; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=UWsMQjWV2vPlmAZwr13SnFrA1+Vxf9k10ooF0s0GV8M=; b=LYp9d/xu1MijBaAr8aeomMqU4zoKAnFoAy4opoqJSPbNCYljKOzagUOiKCKnuq8qNb ecn3SfIq0SOLsa1Qvc5Rhxv53V1diJrJGs7OFVrf3zIVE/JlpydmgA1JLLSntiHxdL2Z DIdOAglL8WosTVWFcZJv9AqJ4pLNj03oiJN16hRcZ+aB+QTiIgj1MdWeyQ8qKcsS6DEA BzOq4qVe0NxfcZlBl2lBsQ42ewiEib3fXZfMq35VBXIO0Ai7Nbqj8u1lkGEA1yKUy1Mx +Q8kUbOUd9iD6SodxEIVKq2yRwCkbfem2VroVu/9BU02OM+OXouaLDWsUkPK0IjVh/+0 0rDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774571079; x=1775175879; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UWsMQjWV2vPlmAZwr13SnFrA1+Vxf9k10ooF0s0GV8M=; b=K//ZWtDOtrMvCgQ49MxEiAefj7SWfGs7XeUc7ye3N2V2kpiLfLwGD/sZIwUw5y++Vd w01Oj+3v+2pYjANDx5z1Wskaokqmb5YeT1JhwX6uQ0NYdZLteoMvI6Qife8lKN0nxH8r RAO/O81Sul1ojKoArWNG/knolwzHRmpzhyq5S8RmPjaQ6SBPWQl+5DACvO1TVKpeuHZr njHNX8+pzlHNiZprCgAh8Jqy5r/k6MFFr8CgnF27utxYD/d0y7vqJPv5J95yQcEEFi+D CiklE6oZwHfzjV3AvxLMZTHobJ+bqWB8g7Bq4x9TLUs2akcSOfPjWo7038s27tVoA1XI zL6A== X-Gm-Message-State: AOJu0YwJVzUQxO40nXbsOh/5nJ29asAXfzhe053AixXp6ET8xdfHHDii yEFsDzJBsxIv4KoSaOSjx6IhrzaJR9IWt1wcwZve14rt30Zv1i8tN0TX X-Gm-Gg: ATEYQzy6MFq4U7cxCzMzwecmRG+dzPbImKSJhKncXz66kfUC6rwwpdKQIPqH8ZuYyw3 iLsY7ufEhwXfgX5IjA3kkuLjbjj3XH2B9hZM9nOp+ft0nHNJhKF6nSCE5OZmM3OAvXwGhEoQOo+ Az5WYlKXLkdO4rtIO+e4clzQdBkPtmb3jHilUws9MIIxYnkQG36EYbzTSF/xp1eHercnWc9lJlY P70tOlbOV7GIDltKPxOD38g2sS56JXrq1iA+ui1x1NUnWDQvF748Us3OUVOSkXsYOXWKjNWofjW zjyTMJgKjnUTNvheG+LxW16Ves0cJSINjT7UeATU1pHJFL5XRKZLUaqmkzKuWXG3sEJJ89gEnMz SLFqXGEbiA3VkbwLJxHd4nQX4hgN7hvu8QxEURofWDwD6qWEBjCP18UF1dBL0vklR8BK8ehZ6bM DgBAHlTGGTopd/WW/MgBO3j5Vfd1owUCWWrUHBQbpvVGV1QBOVlcmu6BG2zVIMye+iYlt0gUBcg Xw= X-Received: by 2002:a17:902:ef4c:b0:2b0:6ce3:8f7 with SMTP id d9443c01a7336-2b0cdd14590mr5120905ad.43.1774571079318; Thu, 26 Mar 2026 17:24:39 -0700 (PDT) Received: from mi-HP-ProDesk-680-G6-PCI-Microtower-PC.mioffice.cn ([43.224.245.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b0bc76b936sm41568675ad.11.2026.03.26.17.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2026 17:24:39 -0700 (PDT) From: zhidao su X-Google-Original-From: zhidao su To: bpf@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, ihor.solodrai@linux.dev, corbet@lwn.net, nathan@kernel.org, zhidao su Subject: [PATCH] kbuild: fix decl_tag_kfuncs gating to require pahole v1.27 Date: Fri, 27 Mar 2026 08:24:33 +0800 Message-ID: <20260327002433.4138813-1-suzhidao@xiaomi.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 >=3D 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 >=3D 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/72e88f29c6f7e14201756e65bd66157= 427a61aaf Fixes: ebb79e96f1ea ("kbuild: bpf: Tell pahole to DECL_TAG kfuncs") Reported-by: Ihor Solodrai Closes: https://lore.kernel.org/bpf/e0ca748d-3204-4160-b37d-0f76cbac8c6c@li= nux.dev/ Signed-off-by: zhidao su --- 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/chan= ges.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 ke= rnel modules as well. This requires pahole v1.22 or later. =20 -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 incompati= ble 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. =20 +config PAHOLE_HAS_DECL_TAG_KFUNCS + def_bool PAHOLE_VERSION >=3D 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) +=3D --= skip_encoding_btf_inconsis else =20 # Switch to using --btf_features for v1.26 and later. -pahole-flags-$(call test-ge, $(pahole-ver), 126) =3D -j$(JOBS) --btf_feat= ures=3Dencode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consi= stent_func,decl_tag_kfuncs +pahole-flags-$(call test-ge, $(pahole-ver), 126) =3D -j$(JOBS) --btf_feat= ures=3Dencode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consi= stent_func + +# decl_tag_kfuncs was implemented in pahole v1.27 (commit 72e88f29c). +# It was incorrectly gated on >=3D 126 by ebb79e96f1ea. +pahole-flags-$(call test-ge, $(pahole-ver), 127) +=3D --btf_features=3Ddec= l_tag_kfuncs =20 pahole-flags-$(call test-ge, $(pahole-ver), 130) +=3D --btf_features=3Datt= ributes =20 --=20 2.43.0