netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net PATCH 0/5] sockmap fixes for net
@ 2017-10-18 14:09 John Fastabend
  2017-10-18 14:10 ` [net PATCH 1/5] bpf: enforce TCP only support for sockmap John Fastabend
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: John Fastabend @ 2017-10-18 14:09 UTC (permalink / raw)
  To: alexei.starovoitov, davem; +Cc: netdev, borkmann

The following implements a set of fixes for sockmap and changes the
API slightly in a few places to reduce preempt_disable/enable scope.
We do this here in net because it requires an API change and this
avoids getting stuck with legacy API going forward.

The short description:

Access to skb mark is removed, it is problematic when we add
features in the future because mark is a union and used by the
TCP/socket code internally. We don't want to expose this to the
BPF programs or let programs change the values.

The other change is caching metadata in the skb itself between
when the BPF program returns a redirect code and the core code
implements the redirect. This avoids having per cpu metadata.

Finally, tighten restriction on using sockmap to CAP_NET_ADMIN and
only SOCK_STREAM sockets.

Thanks,
John

---

John Fastabend (5):
      bpf: enforce TCP only support for sockmap
      bpf: avoid preempt enable/disable in sockmap using tcp_skb_cb region
      bpf: remove mark access for SK_SKB program types
      bpf: require CAP_NET_ADMIN when using sockmap maps
      bpf: require CAP_NET_ADMIN when using devmap


 include/linux/filter.h                             |    2 +
 include/net/tcp.h                                  |    5 +++
 kernel/bpf/devmap.c                                |    3 ++
 kernel/bpf/sockmap.c                               |   28 ++++++++++++------
 net/core/filter.c                                  |   31 ++++++++++----------
 samples/sockmap/sockmap_kern.c                     |    2 +
 tools/include/uapi/linux/bpf.h                     |    3 +-
 tools/testing/selftests/bpf/bpf_helpers.h          |    2 +
 tools/testing/selftests/bpf/sockmap_verdict_prog.c |    4 +--
 tools/testing/selftests/bpf/test_maps.c            |   12 +++++++-
 tools/testing/selftests/bpf/test_verifier.c        |   16 +++++++++-
 11 files changed, 74 insertions(+), 34 deletions(-)

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

end of thread, other threads:[~2017-10-20 12:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-18 14:09 [net PATCH 0/5] sockmap fixes for net John Fastabend
2017-10-18 14:10 ` [net PATCH 1/5] bpf: enforce TCP only support for sockmap John Fastabend
2017-10-18 17:33   ` Alexei Starovoitov
2017-10-18 14:10 ` [net PATCH 2/5] bpf: avoid preempt enable/disable in sockmap using tcp_skb_cb region John Fastabend
2017-10-18 17:36   ` Alexei Starovoitov
2017-10-18 14:10 ` [net PATCH 3/5] bpf: remove mark access for SK_SKB program types John Fastabend
2017-10-18 17:34   ` Alexei Starovoitov
2017-10-18 14:11 ` [net PATCH 4/5] bpf: require CAP_NET_ADMIN when using sockmap maps John Fastabend
2017-10-18 17:34   ` Alexei Starovoitov
2017-10-18 14:11 ` [net PATCH 5/5] bpf: require CAP_NET_ADMIN when using devmap John Fastabend
2017-10-18 17:34   ` Alexei Starovoitov
2017-10-20 12:01 ` [net PATCH 0/5] sockmap fixes for net David Miller

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).