Regression for ubuntu_bpf test build caused by upstream bdeeed3498c7
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-kernel-tests |
Fix Released
|
Undecided
|
Po-Hsu Lin | ||
linux (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Jammy |
Fix Released
|
Medium
|
Po-Hsu Lin | ||
Lunar |
Fix Released
|
Medium
|
Unassigned |
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_
ubuntu_
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_
[Test Plan]
Build bpf selftest in tools/testing/
make headers; make -C tools/testing/
clean all KDIR=/usr/
The build can finish successfully with patched kernel source code.
[Where problems could occur]
Fix limited to testing tool, if this fix 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_
CLNG-BPF [test_maps] test_btf_newkv.o
CLNG-BPF [test_maps] test_btf_nokv.o
CLNG-BPF [test_maps] test_btf_
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/
make: Leaving directory '/home/
stderr:
Warning: Kernel ABI header at 'tools/
Warning: Kernel ABI header at 'tools/
Warning: Kernel ABI header at 'tools/
progs/test_
progs/test_
^
progs/test_
^
/home/ubuntu/
#define offsetof(type, member) ((unsigned long)&((type *)0)->member)
progs/test_
progs/test_
^
progs/test_
^
/home/ubuntu/
#define offsetof(type, member) ((unsigned long)&((type *)0)->member)
2 errors generated.
make[1]: *** [Makefile:470: /home/ubuntu/
make: *** [Makefile:171: all] Error 2
Changed in linux (Ubuntu): | |
status: | New → Invalid |
description: | updated |
Changed in ubuntu-kernel-tests: | |
assignee: | nobody → Po-Hsu Lin (cypressyew) |
Changed in linux (Ubuntu Jammy): | |
assignee: | nobody → Po-Hsu Lin (cypressyew) |
status: | New → In Progress |
Changed in ubuntu-kernel-tests: | |
status: | New → In Progress |
description: | updated |
Changed in linux (Ubuntu Jammy): | |
importance: | Undecided → Medium |
Changed in linux (Ubuntu Jammy): | |
status: | In Progress → Fix Committed |
summary: |
- Regression for ubuntu_bpf test build on Jammy 5.15.0-85.95 + Regression for ubuntu_bpf test build caused by upstream bdeeed3498c7 |
tags: |
added: verification-done-focal-linux-intel-iotg-5.15 verification-done-jammy-linux-aws verification-done-jammy-linux-azure verification-done-jammy-linux-bluefield removed: verification-needed-focal-linux-intel-iotg-5.15 verification-needed-jammy-linux-aws verification-needed-jammy-linux-azure verification-needed-jammy-linux-bluefield |
tags: |
added: verification-done-jammy-linux-raspi removed: verification-needed-jammy-linux-raspi |
tags: |
added: verification-done-lunar-linux removed: verification-needed-lunar-linux |
tags: |
added: verification-done-jammy-linux-nvidia-tegra removed: verification-needed-jammy-linux-nvidia-tegra |
tags: |
added: verification-done-jammy-linux-nvidia-tegra-igx removed: verification-needed-jammy-linux-nvidia-tegra-igx |
bisect between -83 and -85 suggests that: 96a62769c26a12f b16c9ac881 is the first bad commit 96a62769c26a12f b16c9ac881
17e95e1a51d7986
commit 17e95e1a51d7986
Author: Andrii Nakryiko <email address hidden>
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 bdeeed3498c7871 c17465bb4f11d1b c67f9098af ]
It seems like __builtin_offset() doesn't preserve CO-RE field offset( ), CO-RE-enabled BPF code using container_of() will be
relocations properly. So if offsetof() macro is defined through
__builtin_
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 <email address hidden>
Signed-off-by: Andrii Nakryiko <email address hidden>
Acked-by: Yonghong Song <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Alexei Starovoitov <email address hidden>
Signed-off-by: Sasha Levin <email address hidden>
Signed-off-by: Kamal Mostafa <email address hidden>
Signed-off-by: Stefan Bader <email address hidden>
tools/ lib/bpf/ bpf_helpers. h | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
$ git bisect log faa03951efa4384 0e10f1bda66] UBUNTU: Ubuntu-5.15.0-85.95 aa03951efa43840 e10f1bda66 5c2ffd15712cada be0dd9865f1] UBUNTU: Ubuntu-5.15.0-83.92 c2ffd15712cadab e0dd9865f1 4967f1b09cac263 004d6bbc240] arm64: dts: qcom: Drop unneeded extra device-specific includes 967f1b09cac2630 04d6bbc240 e421a3d38c49efb 071af327810] cgroup: Do not corrupt task iteration when rebinding subsystem 421a3d38c49efb0 71af327810 e9d50b936902a88 829cd8b0169] rcutorture: Correct name of use_softirq module parameter 9d50b936902a888 29cd8b0169 4b2012095f21a84 33c326ba80d] bpf: Fix bpf socket lookup from tc/xdp to respect socket VRF bindings b2012095f21a843 3c326ba80d 0da203312a25136 dd6ec390cc1] regulator: core: Streamline debugfs operations da203312a25136d d6ec390cc1 1fa850326aa722e 5b63520d40b] wifi: ath9k: fix AR9003 mac hardware hang check register offset calculation fa850326aa722e5 b63520d40b 0c56d725676b110 c47b8e2c52d] sctp: add bpf_bypass_ getsockopt proto callback c56d725676b110c 47b8e2c52d dc94e113e2be6d0 1d1d57c22cc] spi: dw: Round of n_bytes to power of 2 c94e113e2be6d01 d1d57c22cc 4534ef03f543e11 88d31c0f617] bpf: Don't EFAULT for {g,s}setsockopt with wrong optlen
git bisect start
# bad: [bcea2f888a5b1f
git bisect bad bcea2f888a5b1ff
# good: [294374341c622e
git bisect good 294374341c622e5
# bad: [c57a826d334321
git bisect bad c57a826d3343214
# good: [2ba31156e2f29b
git bisect good 2ba31156e2f29be
# good: [1d4a282191f29a
git bisect good 1d4a282191f29ae
# bad: [eced7b1344d4d3
git bisect bad eced7b1344d4d34
# bad: [9f49a01dcfe961
git bisect bad 9f49a01dcfe9610
# good: [3e348272984fc8
git bisect good 3e348272984fc81
# good: [3f64b9b253e320
git bisect good 3f64b9b253e3200
# bad: [cc12b4a5c0bb03
git bisect bad cc12b4a5c0bb03d
# bad: [e340c66481d14e
gi...