← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Bug 2035181] Re: Regression for ubuntu_bpf test build on Jammy 5.15.0-85.95

 

** Description changed:

+ [Impact]
+ Commit bdeeed3498c7 ("libbpf: fix offsetof() and container_of() to work with CO-RE") from stable update breaks the ubuntu_bpf test build and cause net:udpgro_bench.sh, net:udpgro.sh, net:veth.sh in ubuntu_kernel_selftests stopped working, as they require bpf selftest to be built first.
+ 
+ The following is extracted from the commit message:
+ The problem is the new offsetof() does not play nice with static asserts.
+ Given that the context is a static assert (and CO-RE relocation is not
+ needed at compile time), offsetof() usage can be replaced by restoring
+ the original offsetof() definition as __builtin_offsetof().
+ 
+ [ Test Plan ]
+ Build bpf selftest in tools/testing/selftests with the following command:
+ make headers; make -C tools/testing/selftests TARGETS=bpf SKIP_TARGETS= clean all KDIR=/usr/src/linux-headers-5.15.0-85-generic/
+ 
+ The build can finish successfully with patched kernel source code.
+ 
+ [ Where problems could occur ]
+ Fix limited to testing tool, if this patch is incorrect the bpf selftest build will remain broken.
+ 
+ 
+ == Original bug report ==
  Issue found with Jammy 5.15.0-85.95 in cycle 2023.09.04
  
  This issue does not exist with 5.15.0-83.92 in cycle 2023.08.07 (-84 is
  a security cycle, in which the ubuntu_bpf test was not triggered there)
  
  Test build failed with:
-   CLNG-BPF [test_maps] test_btf_map_in_map.o 
-   CLNG-BPF [test_maps] test_btf_newkv.o
-   CLNG-BPF [test_maps] test_btf_nokv.o
-   CLNG-BPF [test_maps] test_btf_skc_cls_ingress.o
-   CLNG-BPF [test_maps] test_cgroup_link.o
-   CLNG-BPF [test_maps] test_check_mtu.o
-   CLNG-BPF [test_maps] test_cls_redirect.o
+   CLNG-BPF [test_maps] test_btf_map_in_map.o
+   CLNG-BPF [test_maps] test_btf_newkv.o
+   CLNG-BPF [test_maps] test_btf_nokv.o
+   CLNG-BPF [test_maps] test_btf_skc_cls_ingress.o
+   CLNG-BPF [test_maps] test_cgroup_link.o
+   CLNG-BPF [test_maps] test_check_mtu.o
+   CLNG-BPF [test_maps] test_cls_redirect.o
  make[1]: Leaving directory '/home/ubuntu/autotest/client/tmp/ubuntu_bpf/src/linux/tools/testing/selftests/bpf'
  make: Leaving directory '/home/ubuntu/autotest/client/tmp/ubuntu_bpf/src/linux/tools/testing/selftests'
  stderr:
  Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'
- Warning: Kernel ABI header at 'tools/include/uapi/linux/netlink.h' differs from latest version at 'include/uapi/linux/netlink.h' 
- Warning: Kernel ABI header at 'tools/include/uapi/linux/if_link.h' differs from latest version at 'include/uapi/linux/if_link.h' 
+ Warning: Kernel ABI header at 'tools/include/uapi/linux/netlink.h' differs from latest version at 'include/uapi/linux/netlink.h'
+ Warning: Kernel ABI header at 'tools/include/uapi/linux/if_link.h' differs from latest version at 'include/uapi/linux/if_link.h'
  progs/test_cls_redirect.c:90:2: error: static_assert expression is not an integral constant expression
-         sizeof(flow_ports_t) !=
-         ^~~~~~~~~~~~~~~~~~~~~~~
+         sizeof(flow_ports_t) !=
+         ^~~~~~~~~~~~~~~~~~~~~~~
  progs/test_cls_redirect.c:91:3: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
-                 offsetofend(struct bpf_sock_tuple, ipv4.dport) -
-                 ^
- progs/test_cls_redirect.c:32:3: note: expanded from macro 'offsetofend' 
-         (offsetof(TYPE, MEMBER) + sizeof((((TYPE *)0)->MEMBER)))
-          ^
+                 offsetofend(struct bpf_sock_tuple, ipv4.dport) -
+                 ^
+ progs/test_cls_redirect.c:32:3: note: expanded from macro 'offsetofend'
+         (offsetof(TYPE, MEMBER) + sizeof((((TYPE *)0)->MEMBER)))
+          ^
  /home/ubuntu/autotest/client/tmp/ubuntu_bpf/src/linux/tools/testing/selftests/bpf/tools/include/bpf/bpf_helpers.h:81:33: note: expanded from macro 'offsetof'
  #define offsetof(type, member)  ((unsigned long)&((type *)0)->member)
-                                  ^
+                                  ^
  progs/test_cls_redirect.c:95:2: error: static_assert expression is not an integral constant expression
-         sizeof(flow_ports_t) !=
-         ^~~~~~~~~~~~~~~~~~~~~~~
+         sizeof(flow_ports_t) !=
+         ^~~~~~~~~~~~~~~~~~~~~~~
  progs/test_cls_redirect.c:96:3: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
-                 offsetofend(struct bpf_sock_tuple, ipv6.dport) -
-                 ^
- progs/test_cls_redirect.c:32:3: note: expanded from macro 'offsetofend' 
-         (offsetof(TYPE, MEMBER) + sizeof((((TYPE *)0)->MEMBER)))
-          ^
+                 offsetofend(struct bpf_sock_tuple, ipv6.dport) -
+                 ^
+ progs/test_cls_redirect.c:32:3: note: expanded from macro 'offsetofend'
+         (offsetof(TYPE, MEMBER) + sizeof((((TYPE *)0)->MEMBER)))
+          ^
  /home/ubuntu/autotest/client/tmp/ubuntu_bpf/src/linux/tools/testing/selftests/bpf/tools/include/bpf/bpf_helpers.h:81:33: note: expanded from macro 'offsetof'
  #define offsetof(type, member)  ((unsigned long)&((type *)0)->member)
-                                  ^
+                                  ^
  2 errors generated.
  make[1]: *** [Makefile:470: /home/ubuntu/autotest/client/tmp/ubuntu_bpf/src/linux/tools/testing/selftests/bpf/test_cls_redirect.o] Error 1
  make: *** [Makefile:171: all] Error 2

** Changed in: ubuntu-kernel-tests
     Assignee: (unassigned) => Po-Hsu Lin (cypressyew)

** Changed in: linux (Ubuntu Jammy)
     Assignee: (unassigned) => Po-Hsu Lin (cypressyew)

** Changed in: linux (Ubuntu Jammy)
       Status: New => In Progress

** Changed in: ubuntu-kernel-tests
       Status: New => In Progress

-- 
You received this bug notification because you are a member of Canonical
Platform QA Team, which is subscribed to ubuntu-kernel-tests.
https://bugs.launchpad.net/bugs/2035181

Title:
  Regression for ubuntu_bpf test build on Jammy 5.15.0-85.95

Status in ubuntu-kernel-tests:
  In Progress
Status in linux package in Ubuntu:
  Invalid
Status in linux source package in Jammy:
  In Progress

Bug description:
  [Impact]
  Commit bdeeed3498c7 ("libbpf: fix offsetof() and container_of() to work with CO-RE") from stable update breaks the ubuntu_bpf test build and cause net:udpgro_bench.sh, net:udpgro.sh, net:veth.sh in ubuntu_kernel_selftests stopped working, as they require bpf selftest to be built first.

  The following is extracted from the commit message:
  The problem is the new offsetof() does not play nice with static asserts.
  Given that the context is a static assert (and CO-RE relocation is not
  needed at compile time), offsetof() usage can be replaced by restoring
  the original offsetof() definition as __builtin_offsetof().

  [ Test Plan ]
  Build bpf selftest in tools/testing/selftests with the following command:
  make headers; make -C tools/testing/selftests TARGETS=bpf SKIP_TARGETS= clean all KDIR=/usr/src/linux-headers-5.15.0-85-generic/

  The build can finish successfully with patched kernel source code.

  [ Where problems could occur ]
  Fix limited to testing tool, if this patch is incorrect the bpf selftest build will remain broken.

  
  == Original bug report ==
  Issue found with Jammy 5.15.0-85.95 in cycle 2023.09.04

  This issue does not exist with 5.15.0-83.92 in cycle 2023.08.07 (-84
  is a security cycle, in which the ubuntu_bpf test was not triggered
  there)

  Test build failed with:
    CLNG-BPF [test_maps] test_btf_map_in_map.o
    CLNG-BPF [test_maps] test_btf_newkv.o
    CLNG-BPF [test_maps] test_btf_nokv.o
    CLNG-BPF [test_maps] test_btf_skc_cls_ingress.o
    CLNG-BPF [test_maps] test_cgroup_link.o
    CLNG-BPF [test_maps] test_check_mtu.o
    CLNG-BPF [test_maps] test_cls_redirect.o
  make[1]: Leaving directory '/home/ubuntu/autotest/client/tmp/ubuntu_bpf/src/linux/tools/testing/selftests/bpf'
  make: Leaving directory '/home/ubuntu/autotest/client/tmp/ubuntu_bpf/src/linux/tools/testing/selftests'
  stderr:
  Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'
  Warning: Kernel ABI header at 'tools/include/uapi/linux/netlink.h' differs from latest version at 'include/uapi/linux/netlink.h'
  Warning: Kernel ABI header at 'tools/include/uapi/linux/if_link.h' differs from latest version at 'include/uapi/linux/if_link.h'
  progs/test_cls_redirect.c:90:2: error: static_assert expression is not an integral constant expression
          sizeof(flow_ports_t) !=
          ^~~~~~~~~~~~~~~~~~~~~~~
  progs/test_cls_redirect.c:91:3: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
                  offsetofend(struct bpf_sock_tuple, ipv4.dport) -
                  ^
  progs/test_cls_redirect.c:32:3: note: expanded from macro 'offsetofend'
          (offsetof(TYPE, MEMBER) + sizeof((((TYPE *)0)->MEMBER)))
           ^
  /home/ubuntu/autotest/client/tmp/ubuntu_bpf/src/linux/tools/testing/selftests/bpf/tools/include/bpf/bpf_helpers.h:81:33: note: expanded from macro 'offsetof'
  #define offsetof(type, member)  ((unsigned long)&((type *)0)->member)
                                   ^
  progs/test_cls_redirect.c:95:2: error: static_assert expression is not an integral constant expression
          sizeof(flow_ports_t) !=
          ^~~~~~~~~~~~~~~~~~~~~~~
  progs/test_cls_redirect.c:96:3: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
                  offsetofend(struct bpf_sock_tuple, ipv6.dport) -
                  ^
  progs/test_cls_redirect.c:32:3: note: expanded from macro 'offsetofend'
          (offsetof(TYPE, MEMBER) + sizeof((((TYPE *)0)->MEMBER)))
           ^
  /home/ubuntu/autotest/client/tmp/ubuntu_bpf/src/linux/tools/testing/selftests/bpf/tools/include/bpf/bpf_helpers.h:81:33: note: expanded from macro 'offsetof'
  #define offsetof(type, member)  ((unsigned long)&((type *)0)->member)
                                   ^
  2 errors generated.
  make[1]: *** [Makefile:470: /home/ubuntu/autotest/client/tmp/ubuntu_bpf/src/linux/tools/testing/selftests/bpf/test_cls_redirect.o] Error 1
  make: *** [Makefile:171: all] Error 2

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/2035181/+subscriptions



References