mbox series

[v1,bpf-next,00/17] Retire progs/test_sock_addr.c

Message ID 20240510190246.3247730-1-jrife@google.com (mailing list archive)
Headers show
Series Retire progs/test_sock_addr.c | expand

Message

Jordan Rife May 10, 2024, 7:02 p.m. UTC
This patch series migrates remaining tests from bpf/test_sock_addr.c to
prog_tests/sock_addr.c and progs/verifier_sock_addr.c in order to fully
retire the old-style test program and expands test coverage to test
previously untested scenarios related to sockaddr hooks.

This is a continuation of the work started recently during the expansion
of prog_tests/sock_addr.c.

Link: https://lore.kernel.org/bpf/20240429214529.2644801-1-jrife@google.com/T/#u

=======
Patches
=======
* Patch 1 moves tests that check valid return values for recvmsg hooks
  into progs/verifier_sock_addr.c, a new addition to the verifier test
  suite.
* Patches 2-5 lay the groundwork for test migration, enabling
  prog_tests/sock_addr.c to handle more test dimensions.
* Patches 6-11 move existing tests to prog_tests/sock_addr.c.
* Patch 12 removes some redundant test cases.
* Patches 14-17 expand on existing test coverage.

Jordan Rife (17):
  selftests/bpf: Migrate recvmsg* return code tests to
    verifier_sock_addr.c
  selftests/bpf: Use program name for skel load/destroy functions
  selftests/bpf: Handle LOAD_REJECT test cases
  selftests/bpf: Handle ATTACH_REJECT test cases
  selftests/bpf: Handle SYSCALL_EPERM and SYSCALL_ENOTSUPP test cases
  selftests/bpf: Migrate WILDCARD_IP test
  selftests/bpf: Migrate sendmsg deny test cases
  selftests/bpf: Migrate sendmsg6 v4 mapped address tests
  selftests/bpf: Migrate wildcard destination rewrite test
  selftests/bpf: Migrate expected_attach_type tests
  selftests/bpf: Migrate ATTACH_REJECT test cases
  selftests/bpf: Remove redundant sendmsg test cases
  selftests/bpf: Retire test_sock_addr.(c|sh)
  selftests/bpf: Expand sockaddr program return value tests
  sefltests/bpf: Expand sockaddr hook deny tests
  selftests/bpf: Expand getsockname and getpeername tests
  selftests/bpf: Expand ATTACH_REJECT tests

 tools/testing/selftests/bpf/.gitignore        |    1 -
 tools/testing/selftests/bpf/Makefile          |    4 +-
 .../selftests/bpf/prog_tests/sock_addr.c      | 1821 +++++++++++++++--
 .../selftests/bpf/prog_tests/verifier.c       |    2 +
 .../testing/selftests/bpf/progs/bind4_prog.c  |    6 +
 .../testing/selftests/bpf/progs/bind6_prog.c  |    6 +
 .../selftests/bpf/progs/connect4_prog.c       |    6 +
 .../selftests/bpf/progs/connect6_prog.c       |    6 +
 .../selftests/bpf/progs/connect_unix_prog.c   |    6 +
 .../selftests/bpf/progs/getpeername4_prog.c   |   24 +
 .../selftests/bpf/progs/getpeername6_prog.c   |   31 +
 .../selftests/bpf/progs/getsockname4_prog.c   |   24 +
 .../selftests/bpf/progs/getsockname6_prog.c   |   31 +
 .../selftests/bpf/progs/sendmsg4_prog.c       |    6 +
 .../selftests/bpf/progs/sendmsg6_prog.c       |   57 +
 .../selftests/bpf/progs/sendmsg_unix_prog.c   |    6 +
 .../selftests/bpf/progs/verifier_sock_addr.c  |  331 +++
 tools/testing/selftests/bpf/test_sock_addr.c  | 1140 -----------
 tools/testing/selftests/bpf/test_sock_addr.sh |   58 -
 19 files changed, 2142 insertions(+), 1424 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/getpeername4_prog.c
 create mode 100644 tools/testing/selftests/bpf/progs/getpeername6_prog.c
 create mode 100644 tools/testing/selftests/bpf/progs/getsockname4_prog.c
 create mode 100644 tools/testing/selftests/bpf/progs/getsockname6_prog.c
 create mode 100644 tools/testing/selftests/bpf/progs/verifier_sock_addr.c
 delete mode 100644 tools/testing/selftests/bpf/test_sock_addr.c
 delete mode 100755 tools/testing/selftests/bpf/test_sock_addr.sh

Comments

Andrii Nakryiko May 10, 2024, 10:05 p.m. UTC | #1
On Fri, May 10, 2024 at 12:08 PM Jordan Rife <jrife@google.com> wrote:
>
> This patch series migrates remaining tests from bpf/test_sock_addr.c to
> prog_tests/sock_addr.c and progs/verifier_sock_addr.c in order to fully
> retire the old-style test program and expands test coverage to test
> previously untested scenarios related to sockaddr hooks.
>
> This is a continuation of the work started recently during the expansion
> of prog_tests/sock_addr.c.
>
> Link: https://lore.kernel.org/bpf/20240429214529.2644801-1-jrife@google.com/T/#u
>
> =======
> Patches
> =======
> * Patch 1 moves tests that check valid return values for recvmsg hooks
>   into progs/verifier_sock_addr.c, a new addition to the verifier test
>   suite.
> * Patches 2-5 lay the groundwork for test migration, enabling
>   prog_tests/sock_addr.c to handle more test dimensions.
> * Patches 6-11 move existing tests to prog_tests/sock_addr.c.
> * Patch 12 removes some redundant test cases.
> * Patches 14-17 expand on existing test coverage.
>
> Jordan Rife (17):
>   selftests/bpf: Migrate recvmsg* return code tests to
>     verifier_sock_addr.c
>   selftests/bpf: Use program name for skel load/destroy functions
>   selftests/bpf: Handle LOAD_REJECT test cases
>   selftests/bpf: Handle ATTACH_REJECT test cases
>   selftests/bpf: Handle SYSCALL_EPERM and SYSCALL_ENOTSUPP test cases
>   selftests/bpf: Migrate WILDCARD_IP test
>   selftests/bpf: Migrate sendmsg deny test cases
>   selftests/bpf: Migrate sendmsg6 v4 mapped address tests
>   selftests/bpf: Migrate wildcard destination rewrite test
>   selftests/bpf: Migrate expected_attach_type tests
>   selftests/bpf: Migrate ATTACH_REJECT test cases
>   selftests/bpf: Remove redundant sendmsg test cases
>   selftests/bpf: Retire test_sock_addr.(c|sh)
>   selftests/bpf: Expand sockaddr program return value tests
>   sefltests/bpf: Expand sockaddr hook deny tests
>   selftests/bpf: Expand getsockname and getpeername tests
>   selftests/bpf: Expand ATTACH_REJECT tests
>
>  tools/testing/selftests/bpf/.gitignore        |    1 -
>  tools/testing/selftests/bpf/Makefile          |    4 +-
>  .../selftests/bpf/prog_tests/sock_addr.c      | 1821 +++++++++++++++--
>  .../selftests/bpf/prog_tests/verifier.c       |    2 +
>  .../testing/selftests/bpf/progs/bind4_prog.c  |    6 +
>  .../testing/selftests/bpf/progs/bind6_prog.c  |    6 +
>  .../selftests/bpf/progs/connect4_prog.c       |    6 +
>  .../selftests/bpf/progs/connect6_prog.c       |    6 +
>  .../selftests/bpf/progs/connect_unix_prog.c   |    6 +
>  .../selftests/bpf/progs/getpeername4_prog.c   |   24 +
>  .../selftests/bpf/progs/getpeername6_prog.c   |   31 +
>  .../selftests/bpf/progs/getsockname4_prog.c   |   24 +
>  .../selftests/bpf/progs/getsockname6_prog.c   |   31 +
>  .../selftests/bpf/progs/sendmsg4_prog.c       |    6 +
>  .../selftests/bpf/progs/sendmsg6_prog.c       |   57 +
>  .../selftests/bpf/progs/sendmsg_unix_prog.c   |    6 +
>  .../selftests/bpf/progs/verifier_sock_addr.c  |  331 +++
>  tools/testing/selftests/bpf/test_sock_addr.c  | 1140 -----------
>  tools/testing/selftests/bpf/test_sock_addr.sh |   58 -
>  19 files changed, 2142 insertions(+), 1424 deletions(-)
>  create mode 100644 tools/testing/selftests/bpf/progs/getpeername4_prog.c
>  create mode 100644 tools/testing/selftests/bpf/progs/getpeername6_prog.c
>  create mode 100644 tools/testing/selftests/bpf/progs/getsockname4_prog.c
>  create mode 100644 tools/testing/selftests/bpf/progs/getsockname6_prog.c
>  create mode 100644 tools/testing/selftests/bpf/progs/verifier_sock_addr.c
>  delete mode 100644 tools/testing/selftests/bpf/test_sock_addr.c
>  delete mode 100755 tools/testing/selftests/bpf/test_sock_addr.sh
>
> --
> 2.45.0.118.g7fe29c98d7-goog
>

This patch set causes BPF CI to fail to build BPF selftests ([0]),
please check and fix. Thanks!

  [0] https://github.com/kernel-patches/bpf/actions/runs/9036931713/job/24834899012
Jordan Rife May 10, 2024, 10:12 p.m. UTC | #2
Andrii,

It looks like the PR bot dropped one of the commits from the patch
series which is why it didn't build.

> selftests/bpf: Handle ATTACH_REJECT test cases

Is there any way to get it to recreate the PR with all 17 patches?

-Jordan
Andrii Nakryiko May 10, 2024, 10:32 p.m. UTC | #3
On Fri, May 10, 2024 at 3:13 PM Jordan Rife <jrife@google.com> wrote:
>
> Andrii,
>
> It looks like the PR bot dropped one of the commits from the patch
> series which is why it didn't build.
>
> > selftests/bpf: Handle ATTACH_REJECT test cases
>
> Is there any way to get it to recreate the PR with all 17 patches?
>

I marked it back as "New" in patchworks and this time BPF CI picked up
all patches, I think. Will let it run, thanks for noticing this! You
don't need to resend anything just yet.


> -Jordan
patchwork-bot+netdevbpf@kernel.org May 13, 2024, 12:20 a.m. UTC | #4
Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Fri, 10 May 2024 14:02:17 -0500 you wrote:
> This patch series migrates remaining tests from bpf/test_sock_addr.c to
> prog_tests/sock_addr.c and progs/verifier_sock_addr.c in order to fully
> retire the old-style test program and expands test coverage to test
> previously untested scenarios related to sockaddr hooks.
> 
> This is a continuation of the work started recently during the expansion
> of prog_tests/sock_addr.c.
> 
> [...]

Here is the summary with links:
  - [v1,bpf-next,01/17] selftests/bpf: Migrate recvmsg* return code tests to verifier_sock_addr.c
    https://git.kernel.org/bpf/bpf-next/c/73964e9085bb
  - [v1,bpf-next,02/17] selftests/bpf: Use program name for skel load/destroy functions
    https://git.kernel.org/bpf/bpf-next/c/86b65c6db019
  - [v1,bpf-next,03/17] selftests/bpf: Handle LOAD_REJECT test cases
    https://git.kernel.org/bpf/bpf-next/c/5eff48f33fb7
  - [v1,bpf-next,04/17] selftests/bpf: Handle ATTACH_REJECT test cases
    https://git.kernel.org/bpf/bpf-next/c/5a047b2226c0
  - [v1,bpf-next,05/17] selftests/bpf: Handle SYSCALL_EPERM and SYSCALL_ENOTSUPP test cases
    https://git.kernel.org/bpf/bpf-next/c/a2618c0d8542
  - [v1,bpf-next,06/17] selftests/bpf: Migrate WILDCARD_IP test
    https://git.kernel.org/bpf/bpf-next/c/d1b24fcf1c16
  - [v1,bpf-next,07/17] selftests/bpf: Migrate sendmsg deny test cases
    https://git.kernel.org/bpf/bpf-next/c/f46a10483b27
  - [v1,bpf-next,08/17] selftests/bpf: Migrate sendmsg6 v4 mapped address tests
    https://git.kernel.org/bpf/bpf-next/c/54462e8452f1
  - [v1,bpf-next,09/17] selftests/bpf: Migrate wildcard destination rewrite test
    https://git.kernel.org/bpf/bpf-next/c/8eaf8056a44b
  - [v1,bpf-next,10/17] selftests/bpf: Migrate expected_attach_type tests
    https://git.kernel.org/bpf/bpf-next/c/b0f3af0bffef
  - [v1,bpf-next,11/17] selftests/bpf: Migrate ATTACH_REJECT test cases
    https://git.kernel.org/bpf/bpf-next/c/cded71f595c0
  - [v1,bpf-next,12/17] selftests/bpf: Remove redundant sendmsg test cases
    https://git.kernel.org/bpf/bpf-next/c/9c3f17862fae
  - [v1,bpf-next,13/17] selftests/bpf: Retire test_sock_addr.(c|sh)
    https://git.kernel.org/bpf/bpf-next/c/61ecfdfce264
  - [v1,bpf-next,14/17] selftests/bpf: Expand sockaddr program return value tests
    https://git.kernel.org/bpf/bpf-next/c/1e0a8367c89f
  - [v1,bpf-next,15/17] sefltests/bpf: Expand sockaddr hook deny tests
    https://git.kernel.org/bpf/bpf-next/c/dfb7539b47b5
  - [v1,bpf-next,16/17] selftests/bpf: Expand getsockname and getpeername tests
    https://git.kernel.org/bpf/bpf-next/c/bc467e953e4f
  - [v1,bpf-next,17/17] selftests/bpf: Expand ATTACH_REJECT tests
    https://git.kernel.org/bpf/bpf-next/c/a3d3eb957ddc

You are awesome, thank you!