netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/5] bpf: Hooks for sys_sendmsg
@ 2018-05-19  2:21 Andrey Ignatov
  2018-05-19  2:21 ` [PATCH bpf-next 1/5] " Andrey Ignatov
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Andrey Ignatov @ 2018-05-19  2:21 UTC (permalink / raw)
  To: netdev; +Cc: Andrey Ignatov, davem, ast, daniel, kernel-team

This path set adds BPF hooks for sys_sendmsg similar to existing hooks for
sys_bind and sys_connect.

Hooks allow to override source IP (including the case when it's set via
cmsg(3)) and destination IP:port for unconnected UDP (slow path). TCP and
connected UDP (fast path) are not affected. This makes UDP support
complete: connected UDP is handled by sys_connect hooks, unconnected by
sys_sendmsg ones.

Similar to sys_connect hooks, sys_sendmsg ones can be used to make system
calls such as sendmsg(2) and sendto(2) return EPERM.

Please see patch 0001 for more details.

Andrey Ignatov (5):
  bpf: Hooks for sys_sendmsg
  bpf: Sync bpf.h to tools/
  libbpf: Support guessing sendmsg{4,6} progs
  selftests/bpf: Prepare test_sock_addr for extension
  selftests/bpf: Selftest for sys_sendmsg hooks

 include/linux/bpf-cgroup.h                   |   23 +-
 include/linux/filter.h                       |    1 +
 include/uapi/linux/bpf.h                     |    8 +
 kernel/bpf/cgroup.c                          |   11 +-
 kernel/bpf/syscall.c                         |    8 +
 net/core/filter.c                            |   39 +
 net/ipv4/udp.c                               |   20 +-
 net/ipv6/udp.c                               |   17 +
 tools/include/uapi/linux/bpf.h               |    8 +
 tools/lib/bpf/libbpf.c                       |    2 +
 tools/testing/selftests/bpf/Makefile         |    3 +-
 tools/testing/selftests/bpf/sendmsg4_prog.c  |   49 ++
 tools/testing/selftests/bpf/sendmsg6_prog.c  |   60 ++
 tools/testing/selftests/bpf/test_sock_addr.c | 1118 +++++++++++++++++++++-----
 14 files changed, 1171 insertions(+), 196 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/sendmsg4_prog.c
 create mode 100644 tools/testing/selftests/bpf/sendmsg6_prog.c

-- 
2.9.5

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-05-22 22:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-19  2:21 [PATCH bpf-next 0/5] bpf: Hooks for sys_sendmsg Andrey Ignatov
2018-05-19  2:21 ` [PATCH bpf-next 1/5] " Andrey Ignatov
2018-05-21 23:16   ` Martin KaFai Lau
2018-05-22 18:04     ` Andrey Ignatov
2018-05-21 23:33   ` kbuild test robot
2018-05-22  0:08   ` kbuild test robot
2018-05-19  2:21 ` [PATCH bpf-next 2/5] bpf: Sync bpf.h to tools/ Andrey Ignatov
2018-05-22 22:33   ` Martin KaFai Lau
2018-05-19  2:21 ` [PATCH bpf-next 3/5] libbpf: Support guessing sendmsg{4,6} progs Andrey Ignatov
2018-05-22 22:33   ` Martin KaFai Lau
2018-05-19  2:21 ` [PATCH bpf-next 4/5] selftests/bpf: Prepare test_sock_addr for extension Andrey Ignatov
2018-05-22 22:34   ` Martin KaFai Lau
2018-05-19  2:21 ` [PATCH bpf-next 5/5] selftests/bpf: Selftest for sys_sendmsg hooks Andrey Ignatov
2018-05-22 22:35   ` Martin KaFai Lau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).