← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Bug 2028932] Re: ubuntu_bpf failed to build with j-oem-6.1.0-1018.18

 

I just finished bisect between -1007 and -1008

ca6f352ba5c8ccde01289d433401f28e6c260e07 is the first bad commit
commit ca6f352ba5c8ccde01289d433401f28e6c260e07
Author: Andrii Nakryiko <andrii@xxxxxxxxxx>
Date:   Mon May 8 23:55:02 2023 -0700

    libbpf: fix offsetof() and container_of() to work with CO-RE
    
    BugLink: https://bugs.launchpad.net/bugs/2028528
    
    [ Upstream commit bdeeed3498c7871c17465bb4f11d1bc67f9098af ]
    
    It seems like __builtin_offset() doesn't preserve CO-RE field
    relocations properly. So if offsetof() macro is defined through
    __builtin_offset(), CO-RE-enabled BPF code using container_of() will be
    subtly and silently broken.
    
    To avoid this problem, redefine offsetof() and container_of() in the
    form that works with CO-RE relocations more reliably.
    
    Fixes: 5fbc220862fc ("tools/libpf: Add offsetof/container_of macro in bpf_helpers.h")
    Reported-by: Lennart Poettering <lennart@xxxxxxxxxxxxxx>
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Acked-by: Yonghong Song <yhs@xxxxxx>
    Link: https://lore.kernel.org/r/20230509065502.2306180-1-andrii@xxxxxxxxxx
    Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
    Signed-off-by: Timo Aaltonen <timo.aaltonen@xxxxxxxxxxxxx>

 tools/lib/bpf/bpf_helpers.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

-- 
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/2028932

Title:
  ubuntu_bpf failed to build with j-oem-6.1.0-1018.18

Status in ubuntu-kernel-tests:
  New
Status in linux-oem-6.1 package in Ubuntu:
  Invalid
Status in linux-oem-6.1 source package in Jammy:
  New

Bug description:
  Issue found with J-oem-6.1.0-1018.18

  Test build failed with:
      CLNG-BPF [test_maps] test_check_mtu.bpf.o
      CLNG-BPF [test_maps] test_cls_redirect.bpf.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:
    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:86: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:86:33: note: expanded from macro 'offsetof'
    #define offsetof(type, member)  ((unsigned long)&((type *)0)->member)
                                     ^
    2 errors generated.
    make[1]: *** [Makefile:531: /home/ubuntu/autotest/client/tmp/ubuntu_bpf/src/linux/tools/testing/selftests/bpf/test_cls_redirect.bpf.o] Error 1
    make: *** [Makefile:160: all] Error 2

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



References