** Description changed:
[ Impact ]
- On Noble systems testing 6.17 backport kernels (OEM/HWE/clouds, etc.)
built
with dwarves/pahole 1.25, the BPF selftests (TARGETS=bpf, e.g. ubuntu_bpf)
fail to build. They were hinted for a while.
- bpf_iter_tasks.bpf.o hits an implicit declaration of
`bpf_copy_from_user_task_str`. The generated vmlinux.h is missing kfunc
prototypes.
- bpftool generates vmlinux.h from the kernel’s BTF. With dwarves 1.25 the
BTF
lacks `DECL_TAG bpf_kfunc`, so the kfunc section is empty and selftests
see
no prototypes.
- Newer `dwarves` (1.26+) would add these tags, but Noble stays on 1.25.
This
was discussed (at least for older series) years ago: Bug #1926330.
- Adding `__attribute__((btf_decl_tag("bpf_kfunc")))` to `__bpf_kfunc` macro
would probably solve this problem but we're using GCC to build kernels and
using clang to build selftests and our GCC parameters are removing this
tag.
- Backporting a newer `dwarves` to Noble is dangerous.
- GCC has only recently gained full BPF support, so the kernel selftests
traditionally rely on clang
- Use of clang to build kernels should be considered.
[ Test Plan ]
1. Run:
$ make -C linux/tools/testing/selftests TARGETS=bpf \
SKIP_TARGETS= clean all \
KDIR=/usr/src/linux-headers-$(uname -r) \
VMLINUX_BTF=/sys/kernel/btf/vmlinux
2. Verify on the running kernel:
- $ bpftool btf dump file /sys/kernel/btf/vmlinux format c | grep \
- bpf_copy_from_user_task_str
+ $ bpftool btf dump file /sys/kernel/btf/vmlinux |
+ grep bpf_copy_from_user_task_str
should show an extern prototype.
3. Verify existence of symbol definition:
$ cat bpf/tools/include/vmlinux.h | grep
bpf_copy_from_user_task_str
should show matches.
[ Other Info ]
- Upstream addresses this by:
1. Using clang to build kernel binaries so no tags are ignored.
2. Passing `decl_tag_kfuncs` to a newer `dwarves` (commit
ebb79e96f1ea ( "kbuild: bpf: Tell pahole to DECL_TAG kfuncs") so that
the tags processed.
3. By having a newer `bpftool` emit kfunc prototypes (commit
770abbb5a25a ("bpftool: Support dumping kfunc prototypes from BTF").
** Changed in: linux (Ubuntu Noble)
Status: In Progress => Confirmed
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2136848
Title:
selftests/bpf: kfunc prototypes missing from vmlinux.h
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2136848/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs