Thread (14 messages) 14 messages, 5 authors, 2014-06-13

[RFC 5/5] x86,seccomp: Add a seccomp fastpath

From: wad@chromium.org (Will Drewry)
Date: 2014-06-13 16:29:31
Also in: linux-arch, linux-mips, lkml

On Wed, Jun 11, 2014 at 5:32 PM, Kees Cook [off-list ref] wrote:
On Wed, Jun 11, 2014 at 3:28 PM, Andy Lutomirski [off-list ref] wrote:
quoted
On Wed, Jun 11, 2014 at 3:27 PM, H. Peter Anvin [off-list ref] wrote:
quoted
On 06/11/2014 03:22 PM, Andy Lutomirski wrote:
quoted
On Wed, Jun 11, 2014 at 3:18 PM, H. Peter Anvin [off-list ref] wrote:
quoted
On 06/11/2014 02:56 PM, Andy Lutomirski wrote:
quoted
13ns is with the simplest nonempty filter.  I hope that empty filters
don't work.
Why wouldn't they?
Is it permissible to fall off the end of a BPF program?  I'm getting
EINVAL trying to install an actual empty filter.  The filter I tested
with was:
What I meant was that there has to be a well-defined behavior for the
program falling off the end anyway, and that that should be preserved.

I guess it is possible to require that all code paths must provably
reach a termination point.
Dunno.  I haven't ever touched any of the actual BPF code.  This whole
patchset only changes the code that invokes the BPF evaluator.
Yes, this is how BPF works: runs to the end or exit early. With
seccomp BPF specifically, the return value defaults to kill the
process. If a filter was missing (NULL), or empty, or didn't
explicitly return with a new value, the default (kill) should be
taken.
Yup - this is just a property of BPF (and a nice one :)

On seccomp_attach_filter this check fires:
  if (fprog->len == 0 || fprog->len > BPF_MAXINSNS)
    return -EINVAL;

As well as in sk_chk_filter:
  if (flen == 0 || flen > BPF_MAXINSNS)
    return -EINVAL;

And:
  /* last instruction must be a RET code */
  switch (filter[flen - 1].code) {
    case BPF_S_RET_K:
    case BPF_S_RET_A:
      return check_load_and_stores(filter, flen);
  }

cheers!
will
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help