All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Fomichev <sdf@fomichev.me>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Stanislav Fomichev <sdf@google.com>,
	Network Development <netdev@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>, David Miller <davem@davemloft.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Simon Horman <simon.horman@netronome.com>,
	Willem de Bruijn <willemb@google.com>,
	Petar Penkov <peterpenkov96@gmail.com>
Subject: Re: [RFC bpf-next v2 1/9] net: introduce __init_skb{,_data,_shinfo} helpers
Date: Thu, 21 Mar 2019 14:13:25 -0700	[thread overview]
Message-ID: <20190321211325.GU7431@mini-arch.hsd1.ca.comcast.net> (raw)
In-Reply-To: <CAADnVQJ+_aEWnMe8FfDX6_5muxgXUPynPrpH62ezwjRORm5RgQ@mail.gmail.com>

On 03/21, Alexei Starovoitov wrote:
> On Thu, Mar 21, 2019 at 9:13 AM Willem de Bruijn
> <willemdebruijn.kernel@gmail.com> wrote:
> >
> > On Thu, Mar 21, 2019 at 12:01 PM Alexei Starovoitov
> > <alexei.starovoitov@gmail.com> wrote:
> > >
> > > On Thu, Mar 21, 2019 at 08:44:33AM -0700, Stanislav Fomichev wrote:
> > > >
> > > > If we can agree that we switch everything to xpd-like, do we deprecate the
> > > > skb-one?
> > >
> > > This whole discussion that have been going on for long time is an indication
> > > that initial bpf flow dissector concept was not thought through
> > > and I regret on merging it in the first place.
> > > Adding more hacks on top of it with fake skbs is not going to make it any better.
> > > Since it's been in the official release we cannot remove it now.
> >
> > This patch set addresses the only open issue.
> >
> > That said, if direction is towards an alternative interface, then it would
> > make sense for the new interface to supplant the existing one for all
> > use-cases, even if that existing one cannot be removed.
> >
> > Essentially a BPF_PROG_TYPE_FLOW_DISSECTOR_RAW that
> > takes a simpler context than skb. And either that or a program of
> > type BPF_PROG_TYPE_FLOW_DISSECTOR can be attached in
> > skb_flow_dissector_bpf_prog_attach, but not both.
> 
> another idea is to keep 'struct __sk_buff' as a context,
> but have kernel side to be something like struct xdp_buff
> and disallow access to fields of __sk_buff depending on
> attach_type.
> and do different ctx rewrite for __sk_buff->foo
> depending on attach_type.
That's a great idea! The only problem that in this case, I guess, we
need another attach_type and need to ask users explicitly attach to it.

What if we go a bit further: always have xdp_buff-like struct in the kernel?
For the real skb it would have data..data_end point to linear packet data (or
the first fragment). We would always prohibit access to most __sk_buff
fields (like in patch #5 from this series). We'd have to write our
own bpf_skb_load_bytes, but that doesn't sound like a big issue.

  reply	other threads:[~2019-03-21 21:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19 22:19 [RFC bpf-next v2 0/9] net: flow_dissector: trigger BPF hook when called from eth_get_headlen Stanislav Fomichev
2019-03-19 22:19 ` [RFC bpf-next v2 1/9] net: introduce __init_skb{,_data,_shinfo} helpers Stanislav Fomichev
2019-03-21  3:39   ` Alexei Starovoitov
2019-03-21  4:44     ` Eric Dumazet
2019-03-21 13:58       ` Willem de Bruijn
2019-03-21 15:44         ` Stanislav Fomichev
2019-03-21 16:00           ` Alexei Starovoitov
2019-03-21 16:13             ` Willem de Bruijn
2019-03-21 20:56               ` Alexei Starovoitov
2019-03-21 21:13                 ` Stanislav Fomichev [this message]
2019-03-19 22:19 ` [RFC bpf-next v2 2/9] net: introduce skb_net helper Stanislav Fomichev
2019-03-20  2:14   ` Willem de Bruijn
2019-03-20 16:49     ` Stanislav Fomichev
2019-03-19 22:19 ` [RFC bpf-next v2 3/9] net: plumb network namespace into __skb_flow_dissect Stanislav Fomichev
2019-03-19 22:19 ` [RFC bpf-next v2 4/9] net: flow_dissector: prepare for no-skb use case Stanislav Fomichev
2019-03-19 22:19 ` [RFC bpf-next v2 5/9] flow_dissector: allow access only to a subset of __sk_buff fields Stanislav Fomichev
2019-03-19 22:19 ` [RFC bpf-next v2 6/9] net: flow_dissector: handle no-skb use case Stanislav Fomichev
2019-03-19 22:19 ` [RFC bpf-next v2 7/9] bpf: when doing BPF_PROG_TEST_RUN for flow dissector use no-skb mode Stanislav Fomichev
2019-03-20  2:14   ` Willem de Bruijn
2019-03-20 16:57     ` Stanislav Fomichev
2019-03-20 18:29       ` Willem de Bruijn
2019-03-20 19:02         ` Stanislav Fomichev
2019-03-20 19:08           ` Willem de Bruijn
2019-03-20 19:19             ` Stanislav Fomichev
2019-03-20 19:23               ` Willem de Bruijn
2019-03-20 19:48                 ` Stanislav Fomichev
2019-03-20 20:03                   ` Willem de Bruijn
2019-03-19 22:19 ` [RFC bpf-next v2 8/9] selftests/bpf: add flow dissector bpf_skb_load_bytes helper test Stanislav Fomichev
2019-03-19 22:19 ` [RFC bpf-next v2 9/9] net: flow_dissector: pass net argument to the eth_get_headlen Stanislav Fomichev

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=20190321211325.GU7431@mini-arch.hsd1.ca.comcast.net \
    --to=sdf@fomichev.me \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=peterpenkov96@gmail.com \
    --cc=sdf@google.com \
    --cc=simon.horman@netronome.com \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.