bpf, sockmap: convert to generic sk_msg interface
Add a generic sk_msg layer, and convert current sockmap and later kTLS over to make use of it. While sk_buff handles network packet representation from netdevice up to socket, sk_msg handles data representation from application to socket layer. This means that sk_msg framework spans across ULP users in the kernel, and enables features such as introspection or filtering of data with the help of BPF programs that operate on this data structure. Latter becomes in particular useful for kTLS where data encryption is deferred into the kernel, and as such enabling the kernel to perform L7 introspection and policy based on BPF for TLS connections where the record is being encrypted after BPF has run and came to a verdict. In order to get there, first step is to transform open coding of scatter-gather list handling into a common core framework that subsystems can use. The code itself has been split and refactored into three bigger pieces: i) the generic sk_msg API which deals with managing the scatter gather ring, providing helpers for walking and mangling, transferring application data from user space into it, and preparing it for BPF pre/post-processing, ii) the plain sock map itself where sockets can be attached to or detached from; these bits are independent of i) which can now be used also without sock map, and iii) the integration with plain TCP as one protocol to be used for processing L7 application data (later this could e.g. also be extended to other protocols like UDP). The semantics are the same with the old sock map code and therefore no change of user facing behavior or APIs. While pursuing this work it also helped finding a number of bugs in the old sockmap code that we've fixed already in earlier commits. The test_sockmap kselftest suite passes through fine as well. Joint work with John. Signed-off-by:Daniel Borkmann <daniel@iogearbox.net> Signed-off-by:
John Fastabend <john.fastabend@gmail.com> Signed-off-by:
Alexei Starovoitov <ast@kernel.org>
Showing
- include/linux/bpf.h 11 additions, 22 deletionsinclude/linux/bpf.h
- include/linux/bpf_types.h 1 addition, 1 deletioninclude/linux/bpf_types.h
- include/linux/filter.h 0 additions, 21 deletionsinclude/linux/filter.h
- include/linux/skmsg.h 371 additions, 0 deletionsinclude/linux/skmsg.h
- include/net/tcp.h 27 additions, 0 deletionsinclude/net/tcp.h
- kernel/bpf/Makefile 0 additions, 5 deletionskernel/bpf/Makefile
- kernel/bpf/core.c 0 additions, 2 deletionskernel/bpf/core.c
- kernel/bpf/sockmap.c 0 additions, 2610 deletionskernel/bpf/sockmap.c
- kernel/bpf/syscall.c 3 additions, 3 deletionskernel/bpf/syscall.c
- net/Kconfig 11 additions, 0 deletionsnet/Kconfig
- net/core/Makefile 2 additions, 0 deletionsnet/core/Makefile
- net/core/filter.c 77 additions, 193 deletionsnet/core/filter.c
- net/core/skmsg.c 763 additions, 0 deletionsnet/core/skmsg.c
- net/core/sock_map.c 1002 additions, 0 deletionsnet/core/sock_map.c
- net/ipv4/Makefile 1 addition, 0 deletionsnet/ipv4/Makefile
- net/ipv4/tcp_bpf.c 655 additions, 0 deletionsnet/ipv4/tcp_bpf.c
- net/strparser/Kconfig 1 addition, 3 deletionsnet/strparser/Kconfig
Loading
-
mentioned in commit 0e61e407
-
mentioned in commit 538a5f7a
-
mentioned in commit d900f3d2
-
mentioned in commit f45cf3ae
-
mentioned in commit 7e96ec0e
-
mentioned in commit msm-3.10@7e96ec0e
-
mentioned in commit a430d098
-
mentioned in commit 6305df80
-
mentioned in commit msm-4.19@6305df80
-
mentioned in commit ca70b8ba
-
mentioned in commit 75e072a3
-
mentioned in commit ed1fc5d7
-
mentioned in commit 905d82e6
-
mentioned in commit 7b2e41b2
-
mentioned in commit 43e76736
-
mentioned in commit 1b0d7e51
-
mentioned in commit 46fd10f4
-
mentioned in commit bf2318e2
-
mentioned in commit 2bd517ba
-
mentioned in commit b015f19f
-
mentioned in commit 456f08d2
-
mentioned in commit be848bde
-
mentioned in commit 2a572e30
-
mentioned in commit 9dbc7e0e
-
mentioned in commit 343a932a
Please register or sign in to comment