mbox series

[bpf-next,v5,0/7] bpf: mptcp: Support for mptcp_sock

Message ID 20220519233016.105670-1-mathew.j.martineau@linux.intel.com (mailing list archive)
Headers show
Series bpf: mptcp: Support for mptcp_sock | expand

Message

Mat Martineau May 19, 2022, 11:30 p.m. UTC
This patch set adds BPF access to mptcp_sock structures, along with
associated self tests. You may recognize some of the code from earlier
(https://lore.kernel.org/bpf/20200918121046.190240-6-nicolas.rybowski@tessares.net/)
but it has been reworked quite a bit.


v1 -> v2: Emit BTF type, add func_id checks in verifier.c and bpf_trace.c,
remove build check for CONFIG_BPF_JIT, add selftest check for CONFIG_MPTCP,
and add a patch to include CONFIG_IKCONFIG/CONFIG_IKCONFIG_PROC for the
BPF self tests.

v2 -> v3: Access sysctl through the filesystem to work around CI use of
the more limited busybox sysctl command.

v3 -> v4: Dropped special case kernel code for tcp_sock is_mptcp, use
existing bpf_tcp_helpers.h, and add check for 'ip mptcp monitor' support.

v4 -> v5: Use BPF test skeleton, more consistent use of ASSERT macros,
drop some unnecessary parameters / checks, and use tracing to acquire
MPTCP token.

Geliang Tang (6):
  bpf: add bpf_skc_to_mptcp_sock_proto
  selftests/bpf: Enable CONFIG_IKCONFIG_PROC in config
  selftests/bpf: test bpf_skc_to_mptcp_sock
  selftests/bpf: verify token of struct mptcp_sock
  selftests/bpf: verify ca_name of struct mptcp_sock
  selftests/bpf: verify first of struct mptcp_sock

Nicolas Rybowski (1):
  selftests/bpf: add MPTCP test base

 MAINTAINERS                                   |   1 +
 include/linux/bpf.h                           |   1 +
 include/linux/btf_ids.h                       |   3 +-
 include/net/mptcp.h                           |   6 +
 include/uapi/linux/bpf.h                      |   7 +
 kernel/bpf/verifier.c                         |   1 +
 kernel/trace/bpf_trace.c                      |   2 +
 net/core/filter.c                             |  18 ++
 net/mptcp/Makefile                            |   2 +
 net/mptcp/bpf.c                               |  21 +++
 scripts/bpf_doc.py                            |   2 +
 tools/include/uapi/linux/bpf.h                |   7 +
 tools/testing/selftests/bpf/bpf_tcp_helpers.h |  13 ++
 tools/testing/selftests/bpf/config            |   3 +
 tools/testing/selftests/bpf/network_helpers.c |  40 +++-
 tools/testing/selftests/bpf/network_helpers.h |   2 +
 .../testing/selftests/bpf/prog_tests/mptcp.c  | 174 ++++++++++++++++++
 .../testing/selftests/bpf/progs/mptcp_sock.c  |  89 +++++++++
 18 files changed, 382 insertions(+), 10 deletions(-)
 create mode 100644 net/mptcp/bpf.c
 create mode 100644 tools/testing/selftests/bpf/prog_tests/mptcp.c
 create mode 100644 tools/testing/selftests/bpf/progs/mptcp_sock.c


base-commit: 834650b50ed283d9d34a32b425d668256bf2e487

Comments

Andrii Nakryiko May 20, 2022, 10:46 p.m. UTC | #1
On Thu, May 19, 2022 at 4:30 PM Mat Martineau
<mathew.j.martineau@linux.intel.com> wrote:
>
> This patch set adds BPF access to mptcp_sock structures, along with
> associated self tests. You may recognize some of the code from earlier
> (https://lore.kernel.org/bpf/20200918121046.190240-6-nicolas.rybowski@tessares.net/)
> but it has been reworked quite a bit.
>
>
> v1 -> v2: Emit BTF type, add func_id checks in verifier.c and bpf_trace.c,
> remove build check for CONFIG_BPF_JIT, add selftest check for CONFIG_MPTCP,
> and add a patch to include CONFIG_IKCONFIG/CONFIG_IKCONFIG_PROC for the
> BPF self tests.
>
> v2 -> v3: Access sysctl through the filesystem to work around CI use of
> the more limited busybox sysctl command.
>
> v3 -> v4: Dropped special case kernel code for tcp_sock is_mptcp, use
> existing bpf_tcp_helpers.h, and add check for 'ip mptcp monitor' support.
>
> v4 -> v5: Use BPF test skeleton, more consistent use of ASSERT macros,
> drop some unnecessary parameters / checks, and use tracing to acquire
> MPTCP token.
>
> Geliang Tang (6):
>   bpf: add bpf_skc_to_mptcp_sock_proto
>   selftests/bpf: Enable CONFIG_IKCONFIG_PROC in config
>   selftests/bpf: test bpf_skc_to_mptcp_sock
>   selftests/bpf: verify token of struct mptcp_sock
>   selftests/bpf: verify ca_name of struct mptcp_sock
>   selftests/bpf: verify first of struct mptcp_sock
>
> Nicolas Rybowski (1):
>   selftests/bpf: add MPTCP test base
>
>  MAINTAINERS                                   |   1 +
>  include/linux/bpf.h                           |   1 +
>  include/linux/btf_ids.h                       |   3 +-
>  include/net/mptcp.h                           |   6 +
>  include/uapi/linux/bpf.h                      |   7 +
>  kernel/bpf/verifier.c                         |   1 +
>  kernel/trace/bpf_trace.c                      |   2 +
>  net/core/filter.c                             |  18 ++
>  net/mptcp/Makefile                            |   2 +
>  net/mptcp/bpf.c                               |  21 +++
>  scripts/bpf_doc.py                            |   2 +
>  tools/include/uapi/linux/bpf.h                |   7 +
>  tools/testing/selftests/bpf/bpf_tcp_helpers.h |  13 ++
>  tools/testing/selftests/bpf/config            |   3 +
>  tools/testing/selftests/bpf/network_helpers.c |  40 +++-
>  tools/testing/selftests/bpf/network_helpers.h |   2 +
>  .../testing/selftests/bpf/prog_tests/mptcp.c  | 174 ++++++++++++++++++
>  .../testing/selftests/bpf/progs/mptcp_sock.c  |  89 +++++++++
>  18 files changed, 382 insertions(+), 10 deletions(-)
>  create mode 100644 net/mptcp/bpf.c
>  create mode 100644 tools/testing/selftests/bpf/prog_tests/mptcp.c
>  create mode 100644 tools/testing/selftests/bpf/progs/mptcp_sock.c
>
>
> base-commit: 834650b50ed283d9d34a32b425d668256bf2e487
> --
> 2.36.1
>

I've added missing static for test_base and some other helper and
replaced bzero and memcpy in BPF-side code with __builtin_memset and
__builtin_memcpy (and dropped string.h include, it's not supposed to
be used from BPF-side code). Applied to bpf-next, thanks.
patchwork-bot+netdevbpf@kernel.org May 20, 2022, 10:50 p.m. UTC | #2
Hello:

This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Thu, 19 May 2022 16:30:09 -0700 you wrote:
> This patch set adds BPF access to mptcp_sock structures, along with
> associated self tests. You may recognize some of the code from earlier
> (https://lore.kernel.org/bpf/20200918121046.190240-6-nicolas.rybowski@tessares.net/)
> but it has been reworked quite a bit.
> 
> 
> v1 -> v2: Emit BTF type, add func_id checks in verifier.c and bpf_trace.c,
> remove build check for CONFIG_BPF_JIT, add selftest check for CONFIG_MPTCP,
> and add a patch to include CONFIG_IKCONFIG/CONFIG_IKCONFIG_PROC for the
> BPF self tests.
> 
> [...]

Here is the summary with links:
  - [bpf-next,v5,1/7] bpf: add bpf_skc_to_mptcp_sock_proto
    https://git.kernel.org/bpf/bpf-next/c/3bc253c2e652
  - [bpf-next,v5,2/7] selftests/bpf: Enable CONFIG_IKCONFIG_PROC in config
    https://git.kernel.org/bpf/bpf-next/c/d3294cb1e06d
  - [bpf-next,v5,3/7] selftests/bpf: add MPTCP test base
    https://git.kernel.org/bpf/bpf-next/c/8039d353217c
  - [bpf-next,v5,4/7] selftests/bpf: test bpf_skc_to_mptcp_sock
    https://git.kernel.org/bpf/bpf-next/c/3bc48b56e345
  - [bpf-next,v5,5/7] selftests/bpf: verify token of struct mptcp_sock
    https://git.kernel.org/bpf/bpf-next/c/026622346772
  - [bpf-next,v5,6/7] selftests/bpf: verify ca_name of struct mptcp_sock
    https://git.kernel.org/bpf/bpf-next/c/ccc090f46900
  - [bpf-next,v5,7/7] selftests/bpf: verify first of struct mptcp_sock
    https://git.kernel.org/bpf/bpf-next/c/4f90d034bba9

You are awesome, thank you!
Mat Martineau May 21, 2022, 12:01 a.m. UTC | #3
On Fri, 20 May 2022, Andrii Nakryiko wrote:

> On Thu, May 19, 2022 at 4:30 PM Mat Martineau
> <mathew.j.martineau@linux.intel.com> wrote:
>>
>> This patch set adds BPF access to mptcp_sock structures, along with
>> associated self tests. You may recognize some of the code from earlier
>> (https://lore.kernel.org/bpf/20200918121046.190240-6-nicolas.rybowski@tessares.net/)
>> but it has been reworked quite a bit.
>>
>>
>> v1 -> v2: Emit BTF type, add func_id checks in verifier.c and bpf_trace.c,
>> remove build check for CONFIG_BPF_JIT, add selftest check for CONFIG_MPTCP,
>> and add a patch to include CONFIG_IKCONFIG/CONFIG_IKCONFIG_PROC for the
>> BPF self tests.
>>
>> v2 -> v3: Access sysctl through the filesystem to work around CI use of
>> the more limited busybox sysctl command.
>>
>> v3 -> v4: Dropped special case kernel code for tcp_sock is_mptcp, use
>> existing bpf_tcp_helpers.h, and add check for 'ip mptcp monitor' support.
>>
>> v4 -> v5: Use BPF test skeleton, more consistent use of ASSERT macros,
>> drop some unnecessary parameters / checks, and use tracing to acquire
>> MPTCP token.
>>
>> Geliang Tang (6):
>>   bpf: add bpf_skc_to_mptcp_sock_proto
>>   selftests/bpf: Enable CONFIG_IKCONFIG_PROC in config
>>   selftests/bpf: test bpf_skc_to_mptcp_sock
>>   selftests/bpf: verify token of struct mptcp_sock
>>   selftests/bpf: verify ca_name of struct mptcp_sock
>>   selftests/bpf: verify first of struct mptcp_sock
>>
>> Nicolas Rybowski (1):
>>   selftests/bpf: add MPTCP test base
>>
>>  MAINTAINERS                                   |   1 +
>>  include/linux/bpf.h                           |   1 +
>>  include/linux/btf_ids.h                       |   3 +-
>>  include/net/mptcp.h                           |   6 +
>>  include/uapi/linux/bpf.h                      |   7 +
>>  kernel/bpf/verifier.c                         |   1 +
>>  kernel/trace/bpf_trace.c                      |   2 +
>>  net/core/filter.c                             |  18 ++
>>  net/mptcp/Makefile                            |   2 +
>>  net/mptcp/bpf.c                               |  21 +++
>>  scripts/bpf_doc.py                            |   2 +
>>  tools/include/uapi/linux/bpf.h                |   7 +
>>  tools/testing/selftests/bpf/bpf_tcp_helpers.h |  13 ++
>>  tools/testing/selftests/bpf/config            |   3 +
>>  tools/testing/selftests/bpf/network_helpers.c |  40 +++-
>>  tools/testing/selftests/bpf/network_helpers.h |   2 +
>>  .../testing/selftests/bpf/prog_tests/mptcp.c  | 174 ++++++++++++++++++
>>  .../testing/selftests/bpf/progs/mptcp_sock.c  |  89 +++++++++
>>  18 files changed, 382 insertions(+), 10 deletions(-)
>>  create mode 100644 net/mptcp/bpf.c
>>  create mode 100644 tools/testing/selftests/bpf/prog_tests/mptcp.c
>>  create mode 100644 tools/testing/selftests/bpf/progs/mptcp_sock.c
>>
>>
>> base-commit: 834650b50ed283d9d34a32b425d668256bf2e487
>> --
>> 2.36.1
>>
>
> I've added missing static for test_base and some other helper and
> replaced bzero and memcpy in BPF-side code with __builtin_memset and
> __builtin_memcpy (and dropped string.h include, it's not supposed to
> be used from BPF-side code). Applied to bpf-next, thanks.
>

Thanks for the fixups.

--
Mat Martineau
Intel