** 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. This was hinted for a while.
+   - 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.
+   - 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. 
+   - 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.
+   - 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.
  
-   - Backporting a newer `dwarves` is avoided, so an explicit tagging 
workaround
-     in the kernel source is needed for 6.17 backport kernels.
+   - 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...
  
-   [ Test Plan ]
+   - Backporting a newer `dwarves` is avoided, so an explicit tagging 
workaround
+     in the kernel source is needed for 6.17 backport kernels.
  
-   1. On an unpatched 6.17 kernel built with dwarves 1.25, run:
+   - Use of clang in pipeline should be considered for future.
  
-      $ 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
+   [ Test Plan ]
  
-      Expect an implicit-decl error at progs/bpf_iter_tasks.c:98.
-   2. Apply the patch rebuild the 6.17 kernel package, install, and reboot.
-   3. Verify on the running kernel:
+   1. On an unpatched 6.17 kernel built with dwarves 1.25, run:
  
-      $ bpftool btf dump file /sys/kernel/btf/vmlinux format c | grep \
-        bpf_copy_from_user_task_str
+      $ 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
  
-      should show an extern prototype.
-   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
+      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.
+   3. Verify on the running kernel:
  
-   [ Where problems could occur ]
+      $ bpftool btf dump file /sys/kernel/btf/vmlinux format c | grep \
+        bpf_copy_from_user_task_str
  
-   - The change adds decl tags to all kfuncs in BTF. If wrong, vmlinux.h could
-     gain unexpected kfunc prototypes, and other selftests might start failing 
at
-     build time if their kfuncs are missing. If BTF generation broke, bpftool 
or
-     selftest builds would fail. 
-   - Runtime behavior and ABI are unchanged.
+      should show an extern prototype.
+   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 ]
+   [ 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 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").
  
-   - Questing (24.10) ships dwarves 1.27, so this resolves there
+   - Questing (24.10) ships dwarves 1.27, so this resolves there
  automatically.

-- 
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/ubuntu_bpf: kfunc prototypes missing in vmlinux.h on Noble
  6.17 kernels built with dwarves 1.25

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

Reply via email to