Comment 1 for bug 2035181

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : Re: Regression for ubuntu_bpf test build on Jammy 5.15.0-85.95

bisect between -83 and -85 suggests that:
17e95e1a51d798696a62769c26a12fb16c9ac881 is the first bad commit
commit 17e95e1a51d798696a62769c26a12fb16c9ac881
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 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 <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
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.