From: John Fastabend <john.r.fastabend@gmail.com>
To: alexei.starovoitov@gmail.com, davem@davemloft.net
Cc: netdev@vger.kernel.org, borkmann@iogearbox.net
Subject: [net PATCH 0/5] sockmap fixes for net
Date: Wed, 18 Oct 2017 07:09:48 -0700 [thread overview]
Message-ID: <150833522977.3588.14633565129152334098.stgit@john-XPS-13-9360> (raw)
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(-)
next reply other threads:[~2017-10-18 14:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-18 14:09 John Fastabend [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=150833522977.3588.14633565129152334098.stgit@john-XPS-13-9360 \
--to=john.r.fastabend@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=borkmann@iogearbox.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox