** 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...
+ - 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...
- - Backporting a newer `dwarves` is avoided, so an explicit tagging
workaround
- in the kernel source is needed for 6.17 backport kernels.
+ - Backporting a newer `dwarves` is avoided.
- - Use of clang in pipeline should be considered for future.
+ - Use of clang in pipeline should be considered for future.
[ Test Plan ]
1. On an unpatched 6.17 kernel built with dwarves 1.25, run:
- $ make -C linux/tools/testing/selftests TARGETS=bpf \
- SKIP_TARGETS= clean all \
+ $ 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
- Expect an implicit-decl error at progs/bpf_iter_tasks.c:98.
- 2. Apply the patch rebuild the 6.17 kernel package with clang, install, and
reboot.
+ Expect an implicit declaration error at progs/bpf_iter_tasks.c:98.
+
+ 2. Apply the patch, rebuild a 6.17 backport kernel with clang,
+ install, and reboot.
+
3. Verify on the running kernel:
$ bpftool btf dump file /sys/kernel/btf/vmlinux format c | grep \
bpf_copy_from_user_task_str
should show an extern prototype.
+
+ $ cat bpf/tools/include/vmlinux.h | grep
+ bpf_copy_from_user_task_str
+
+ should show a matching line.
+
4. Re-run the selftest build as in step 1; it should succeed.
- 5. Optionally run the autotest suite for ubuntu_bpf to confirm tests run.
- 6. Verified in a Noble VM: clang 18 + dwarves 1.25
[ Other Info ]
- - Upstream addresses this by passing `decl_tag_kfuncs` to a newer `dwarves`
- (commit ebb79e96f1ea, "kbuild: bpf: Tell pahole to DECL_TAG kfuncs", June
- 12, 2024) and by having bpftool emit kfunc prototypes (commit
770abbb5a25a,
- "bpftool: Support dumping kfunc prototypes from BTF").
+ - Upstream addresses this by:
- - Questing (24.10) ships dwarves 1.27, so this resolves there
- automatically.
+ 1. Using clang to build vmlinux so no tags are ignored
+
+ 2. Passing `decl_tag_kfuncs` to a newer `dwarves` (commit
+ ebb79e96f1ea ( "kbuild: bpf: Tell pahole to DECL_TAG kfuncs")
+
+ 3. By having bpftool emit kfunc prototypes (commit 770abbb5a25a
+ ("bpftool: Support dumping kfunc prototypes from BTF").
** Summary changed:
- selftests/ubuntu_bpf: kfunc prototypes missing in vmlinux.h on Noble 6.17
kernels built with dwarves 1.25
+ kfunc prototypes missing in vmlinux.h
--
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:
kfunc prototypes missing in 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