public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@cpushare.com>
To: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Cc: Herbert Poetzl <herbert@13thfloor.at>
Subject: Re: seccomp for 2.6.11-rc4
Date: Fri, 18 Feb 2005 03:25:51 +0100	[thread overview]
Message-ID: <20050218022551.GN2071@opteron.random> (raw)
In-Reply-To: <20050216052503.GA24484@mail.13thfloor.at>

On Wed, Feb 16, 2005 at 06:25:03AM +0100, Herbert Poetzl wrote:
> hmm, just an idea, but have you thought about using
> an indirect syscall table for your purposes?
> 
>  current->syscall_table 
> 
> and have a table for every 'mode' you want to use ...

That would add an additional level of indirection for every syscall
(you'll have to potentially waste a cacheline to read the address of the
syscall table).

While my current approach is absolutely zero cost for the fast path on
x86-64 and it's a mere s/movb/movw/ for x86 (i.e. zero for x86 too).
Perahps I could even get away with a movb on x86 but frankly I didn't
even try ;)

My priority has been not to change the fast path at all, and clearly I
have to add a bitflag to achieve that. And once I've the bitflag it's
not worth it anymore to change the syscall table, and I can validate the
syscall number right away (this avoid building arrays and other more
complex stuff).

> or maybe have a 'mask' for every syscall (in a 
> separate table) which describes the allowed 'modes'
> 
> just because checking the syscall number in a loop
> doesn't look very scaleable to me ... 

You're right about it being O(N) if you use it for all modes, but it's
really O(1) since it's being used for mode 0 only, and the number of
syscalls in mode 0 is fixed so it's O(1) and more important the number
is so small that it's really like O(1) in practice too (and not only in
math terms just because the number of syscalls in mode 0 is fixed ;).

Each mode can implement the mask as it wishes, so if you were to allow
hundred of syscalls in mode 1 then you'd better implement the check as a
bitmask as you suggested and you can do that while implementing mode 1.

But seccomp isn't designed to allow a ton of syscalls, so there can be
tiny differences between mode 0/1/2 and they should all have very few
syscalls, so I doubt it'd worth implementing the bitmask thingy right now.

Thanks.

      reply	other threads:[~2005-02-18  2:26 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-21 10:06 seccomp for 2.6.11-rc1-bk8 Andrea Arcangeli
2005-01-21 12:03 ` Ingo Molnar
2005-01-21 12:47   ` Ingo Molnar
2005-01-21 12:55     ` Ingo Molnar
2005-01-21 21:31       ` Roland McGrath
2005-01-22  3:25         ` Andrea Arcangeli
2005-01-21 20:24     ` Andrea Arcangeli
2005-01-21 17:39   ` Chris Wright
2005-01-21 18:39     ` Rik van Riel
2005-01-21 18:50       ` Chris Wright
2005-01-21 19:55         ` Ingo Molnar
2005-01-21 20:34           ` Andrea Arcangeli
2005-01-21 20:54             ` Ingo Molnar
2005-01-22  2:51               ` Andrea Arcangeli
2005-01-22 10:32             ` Pavel Machek
2005-01-22 17:25               ` Andrea Arcangeli
2005-01-22 19:42                 ` Pavel Machek
2005-01-22 23:34                   ` Andrea Arcangeli
2005-01-23  0:07                     ` Pavel Machek
2005-01-23  0:46                       ` Andrea Arcangeli
2005-01-23  0:43                     ` Rik van Riel
2005-01-23  0:52                       ` Andrea Arcangeli
2005-01-23  4:43                         ` Valdis.Kletnieks
2005-01-23  6:11                           ` Andrea Arcangeli
2005-01-21 18:59     ` David Wagner
2005-01-21 19:17       ` Chris Wright
2005-01-23  7:34         ` David Wagner
2005-01-24 15:10           ` Daniel Jacobowitz
2005-02-15  9:25           ` Andrea Arcangeli
2005-02-25 19:01             ` David Wagner
2005-01-21 12:11 ` Pavel Machek
2005-02-15  9:32 ` seccomp for 2.6.11-rc4 Andrea Arcangeli
2005-02-16  5:25   ` Herbert Poetzl
2005-02-18  2:25     ` Andrea Arcangeli [this message]

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=20050218022551.GN2071@opteron.random \
    --to=andrea@cpushare.com \
    --cc=akpm@osdl.org \
    --cc=herbert@13thfloor.at \
    --cc=linux-kernel@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