** 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...
+ 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.
- - Use of clang in pipeline should be considered for future.
+ - Use of clang to build kernels should be considered.
[ Test Plan ]
- 1. On an unpatched 6.17 kernel built with dwarves 1.25, run:
+ 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
- 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:
+ 2. 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.
+ 3. Verify existence of symbol definition:
+
$ 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.
+ should show matches.
[ Other Info ]
- Upstream addresses this by:
- 1. Using clang to build vmlinux so no tags are ignored
+ 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")
+ 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 bpftool emit kfunc prototypes (commit 770abbb5a25a
- ("bpftool: Support dumping kfunc prototypes from BTF").
+ 3. By having a newer `bpftool` emit kfunc prototypes (commit
+ 770abbb5a25a ("bpftool: Support dumping kfunc prototypes from BTF").
** 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.
- - Backporting a newer `dwarves` is avoided.
+ - 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
should show an extern prototype.
3. Verify existence of symbol definition:
- $ cat bpf/tools/include/vmlinux.h | grep
+ $ 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").
** 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.
+ 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
+ - 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
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").
--
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