mbox series

[J,SRU,0/1] Fix bpf build failure on Jammy

Message ID 20230915091329.619306-1-po-hsu.lin@canonical.com
Headers show
Series Fix bpf build failure on Jammy | expand

Message

Po-Hsu Lin Sept. 15, 2023, 9:13 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2035181

[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 fix is incorrect the bpf selftest
build will remain broken.


Alan Maguire (1):
  selftests/bpf: fix static assert compilation issue for test_cls_*.c

 tools/testing/selftests/bpf/progs/test_cls_redirect.h | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Stefan Bader Sept. 15, 2023, 9:52 a.m. UTC | #1
On 15.09.23 11:13, Po-Hsu Lin wrote:
> BugLink: https://bugs.launchpad.net/bugs/2035181
> 
> [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 fix is incorrect the bpf selftest
> build will remain broken.
> 
> 
> Alan Maguire (1):
>    selftests/bpf: fix static assert compilation issue for test_cls_*.c
> 
>   tools/testing/selftests/bpf/progs/test_cls_redirect.h | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 

Acked-by: Stefan Bader <stefan.bader@canonical.com>
Roxana Nicolescu Sept. 15, 2023, 10:26 a.m. UTC | #2
On 15/09/2023 11:13, Po-Hsu Lin wrote:
> BugLink: https://bugs.launchpad.net/bugs/2035181
>
> [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 fix is incorrect the bpf selftest
> build will remain broken.
>
>
> Alan Maguire (1):
>    selftests/bpf: fix static assert compilation issue for test_cls_*.c
>
>   tools/testing/selftests/bpf/progs/test_cls_redirect.h | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
Acked-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Stefan Bader Sept. 19, 2023, 3:13 p.m. UTC | #3
On 15.09.23 11:13, Po-Hsu Lin wrote:
> BugLink: https://bugs.launchpad.net/bugs/2035181
> 
> [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 fix is incorrect the bpf selftest
> build will remain broken.
> 
> 
> Alan Maguire (1):
>    selftests/bpf: fix static assert compilation issue for test_cls_*.c
> 
>   tools/testing/selftests/bpf/progs/test_cls_redirect.h | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 

Applied to jammy:linux/master-prep (for re-spin). Thanks.

-Stefan