bisect between -83 and -85 suggests that: 17e95e1a51d798696a62769c26a12fb16c9ac881 is the first bad commit commit 17e95e1a51d798696a62769c26a12fb16c9ac881 Author: Andrii Nakryiko <and...@kernel.org> 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/2032689 [ 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 <lenn...@poettering.net> Signed-off-by: Andrii Nakryiko <and...@kernel.org> Acked-by: Yonghong Song <y...@fb.com> Link: https://lore.kernel.org/r/20230509065502.2306180-1-and...@kernel.org Signed-off-by: Alexei Starovoitov <a...@kernel.org> Signed-off-by: Sasha Levin <sas...@kernel.org> Signed-off-by: Kamal Mostafa <ka...@canonical.com> Signed-off-by: Stefan Bader <stefan.ba...@canonical.com> tools/lib/bpf/bpf_helpers.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) $ git bisect log git bisect start # bad: [bcea2f888a5b1ffaa03951efa43840e10f1bda66] UBUNTU: Ubuntu-5.15.0-85.95 git bisect bad bcea2f888a5b1ffaa03951efa43840e10f1bda66 # good: [294374341c622e5c2ffd15712cadabe0dd9865f1] UBUNTU: Ubuntu-5.15.0-83.92 git bisect good 294374341c622e5c2ffd15712cadabe0dd9865f1 # bad: [c57a826d3343214967f1b09cac263004d6bbc240] arm64: dts: qcom: Drop unneeded extra device-specific includes git bisect bad c57a826d3343214967f1b09cac263004d6bbc240 # good: [2ba31156e2f29be421a3d38c49efb071af327810] cgroup: Do not corrupt task iteration when rebinding subsystem git bisect good 2ba31156e2f29be421a3d38c49efb071af327810 # good: [1d4a282191f29ae9d50b936902a88829cd8b0169] rcutorture: Correct name of use_softirq module parameter git bisect good 1d4a282191f29ae9d50b936902a88829cd8b0169 # bad: [eced7b1344d4d34b2012095f21a8433c326ba80d] bpf: Fix bpf socket lookup from tc/xdp to respect socket VRF bindings git bisect bad eced7b1344d4d34b2012095f21a8433c326ba80d # bad: [9f49a01dcfe9610da203312a25136dd6ec390cc1] regulator: core: Streamline debugfs operations git bisect bad 9f49a01dcfe9610da203312a25136dd6ec390cc1 # good: [3e348272984fc81fa850326aa722e5b63520d40b] wifi: ath9k: fix AR9003 mac hardware hang check register offset calculation git bisect good 3e348272984fc81fa850326aa722e5b63520d40b # good: [3f64b9b253e3200c56d725676b110c47b8e2c52d] sctp: add bpf_bypass_getsockopt proto callback git bisect good 3f64b9b253e3200c56d725676b110c47b8e2c52d # bad: [cc12b4a5c0bb03dc94e113e2be6d01d1d57c22cc] spi: dw: Round of n_bytes to power of 2 git bisect bad cc12b4a5c0bb03dc94e113e2be6d01d1d57c22cc # bad: [e340c66481d14e4534ef03f543e1188d31c0f617] bpf: Don't EFAULT for {g,s}setsockopt with wrong optlen git bisect bad e340c66481d14e4534ef03f543e1188d31c0f617 # bad: [17e95e1a51d798696a62769c26a12fb16c9ac881] libbpf: fix offsetof() and container_of() to work with CO-RE git bisect bad 17e95e1a51d798696a62769c26a12fb16c9ac881 # first bad commit: [17e95e1a51d798696a62769c26a12fb16c9ac881] libbpf: fix offsetof() and container_of() to work with CO-RE Reverting 17e95e1a51d798696a62769c26a12fb16c9ac881 can make this work again. -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. 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: New Status in linux package in Ubuntu: Invalid Status in linux source package in Jammy: New Bug description: 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 -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp