Skip to content

bpf: Fix builds broken by fatal resolve_btfids warnings

Sasha Levin bpf lkml netdev 1 version Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyApplied 3/3

Patches in v1 All 3 applied

#Subject and filesSizeRepliesApplied
1/3bpf: Drop unused entries from special_kfunc_list againkernel/bpf/verifier.c+0 -60 repliesApplied
2/3bpf: Don't reference arena kfuncs when arena isn't builtkernel/bpf/verifier.c+5 -00 repliesApplied
3/3bpf: Fix ksock build with BPF_LSM=y and SECURITY_NETWORK=nnet/core/bpf_ksock.c+6 -11 replyApplied

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchMahe Tardy
1/3
2/3
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH bpf-next 0/3] bpf: Fix builds broken by fatal resolve_btfids warnings

Commit 201a454df948 ("resolve_btfids: Fix the --fatal_warnings exit status") makes resolve_btfids warnings fail the build again with CONFIG_WERROR=y. That exposed BTF ID references to functions some configs don't build. KernelCI has been seeing i386 i386_defconfig+kselftest builds fail on linux-next since next-20261015:

WARN: resolve_btfids: unresolved symbol bpf_arena_reserve_pages
WARN: resolve_btfids: unresolved symbol bpf_arena_free_pages
WARN: resolve_btfids: unresolved symbol bpf_arena_alloc_pages Failed to generate BTF for vmlinux
Try to disable CONFIG_DEBUG_INFO_BTF

https://files.kernelci.org/kbuild-gcc-14-i386-kselftest-6ad2315ca3f195e1aa930c8a/build.log.gz

Patch 1 drops three special_kfunc_list entries that have no users, bpf_arena_reserve_pages among them. Patch 2 makes the remaining arena entries depend on the condition arena.o is built with. Patch 3 fixes the same problem for bpf_lsm_socket_sendmsg in bpf_ksock.c, which breaks x86_64 builds with CONFIG_BPF_LSM=y and CONFIG_SECURITY_NETWORK=n.

The entries left in special_kfunc_list resolve to the same IDs as before, and the IDs that become BTF_ID_UNUSED were already zero.

Tested by building vmlinux with CONFIG_DEBUG_INFO_BTF=y and CONFIG_WERROR=y for i386, x86_64, and x86_64 with CONFIG_BPF_LSM=y and both CONFIG_SECURITY_NETWORK=n and =y, and comparing special_kfunc_list and bpf_lsm_socket_sendmsg_id before and after the series.

Sasha Levin (3):
bpf: Drop unused entries from special_kfunc_list again
bpf: Don't reference arena kfuncs when arena isn't built
bpf: Fix ksock build with BPF_LSM=y and SECURITY_NETWORK=n

 kernel/bpf/verifier.c | 11 +++++------
 net/core/bpf_ksock.c  |  7 ++++++-
 2 files changed, 11 insertions(+), 7 deletions(-)

base-commit: 25bb03f0a47b622b9025a1558bf2095ec1f55d26

Signature · 1 line
2.53.0