[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jJvjq5f7Qw1ADh120jAtUsH+L4BW6CY+uaD7GFN53nPBw@mail.gmail.com>
Date: Tue, 17 Jan 2012 12:34:31 -0800
From: Kees Cook <keescook@...omium.org>
To: Indan Zupancic <indan@....nu>
Cc: Will Drewry <wad@...omium.org>, Oleg Nesterov <oleg@...hat.com>,
linux-kernel@...r.kernel.org, john.johansen@...onical.com,
serge.hallyn@...onical.com, coreyb@...ux.vnet.ibm.com,
pmoore@...hat.com, eparis@...hat.com, djm@...drot.org,
torvalds@...ux-foundation.org, segoon@...nwall.com,
rostedt@...dmis.org, jmorris@...ei.org
Subject: Re: [RFC,PATCH 1/2] seccomp_filters: system call filtering using BPF
On Mon, Jan 16, 2012 at 10:46 PM, Indan Zupancic <indan@....nu> wrote:
> So call it once and store the value in a long. Then copy the low half
> to the right place and then the upper half when on 64 bits. It may not
> look too pretty, but the compiler should be able to optimise almost all
> overhead away and end up with 6 (or 12) int copies. Something like this:
>
> struct bpf_data {
> uint32 syscall_nr;
> uint32 arg_low[MAX_SC_ARGS];
> uint32 arg_high[MAX_SC_ARGS];
> };
>
> void fill_bpf_data(struct task_struct *t, struct pt_regs *r, struct bpf_data *d)
> {
> int i;
> unsigned long arg;
>
> d->syscall_nr = syscall_get_nr(t, r);
> for (i = 0; i < MAX_SC_ARGS; ++i){
> syscall_get_arguments(t, r, i, 1, &arg);
> d->arg_low[i] = arg;
> d->arg_high[i] = arg >> 32;
> }
> }
If this turns out to be expensive, it might be possible to break it up
and load the arguments on demand (and cache them); i.e. have
load_pointer() or similar notice when it is about to access something
other than bpf_data.syscall_nr.
-Kees
--
Kees Cook
ChromeOS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists