All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Vetoshkin Nikita <nikita.vetoshkin@gmail.com>
Cc: David Miller <davem@davemloft.net>, xdp-newbies@vger.kernel.org
Subject: Re: Contextually speaking...
Date: Sun, 14 May 2017 14:48:53 +0200	[thread overview]
Message-ID: <59185235.8060005@iogearbox.net> (raw)
In-Reply-To: <CAFkxUYUspEE2T1cvENKg30MM1OuAccWvS+gnn4uCwDy2R2LRjw@mail.gmail.com>

On 05/14/2017 09:19 AM, Vetoshkin Nikita wrote:
> As I understand from a C compiler point of view ->data and ->data_end
> are just arbitrary pointers embedded in a struct. Where does this
> semantics arises from? I.e. how does eBPF verifier knows that data
> ends where data_end points to?

The verifier only needs to match on data/data_end and makes sure the
program code making use of this is within their bounds. It doesn't
need to know the actual address at verification time. We do this, so
that read/write access to the packet can happen efficiently without
needing to call a helper function to perform the same (and without
having to perform a check on every single access), adding data/data_end
into the context also allows to do all this without changing BPF JIT
compilers. The actual address for data/data_end is filled into the
xdp_buff context structure shortly before the BPF program gets
executed in the driver.

Best,
Daniel

  reply	other threads:[~2017-05-14 12:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-13 22:36 Contextually speaking David Miller
2017-05-14  7:19 ` Vetoshkin Nikita
2017-05-14 12:48   ` Daniel Borkmann [this message]
     [not found] ` <CAFkxUYVNTPxaO02AsV-ur3cgXoK-diZLxF9LMOjZupw0j67h9Q@mail.gmail.com>
2017-05-14 15:52   ` David Miller
2018-01-05 22:22 ` Charlemagne Lasse

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=59185235.8060005@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=nikita.vetoshkin@gmail.com \
    --cc=xdp-newbies@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 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.