[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20140521.170731.1855118307231797714.davem@davemloft.net>
Date: Wed, 21 May 2014 17:07:31 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: ast@...mgrid.com
Cc: dborkman@...hat.com, edumazet@...gle.com, keescook@...omium.org,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next] net: filter: cleanup invocation of internal
BPF
From: Alexei Starovoitov <ast@...mgrid.com>
Date: Mon, 19 May 2014 14:56:14 -0700
> Kernel API for classic BPF socket filters is:
>
> sk_unattached_filter_create() - validate classic BPF, convert, JIT
> SK_RUN_FILTER() - run it
> sk_unattached_filter_destroy() - destroy socket filter
>
> Cleanup internal BPF kernel API as following:
>
> sk_filter_select_runtime() - final step of internal BPF creation.
> Try to JIT internal BPF program, if JIT is not available select interpreter
> SK_RUN_FILTER() - run it
> sk_filter_free() - free internal BPF program
>
> Disallow direct calls to BPF interpreter. Execution of the BPF program should
> be done with SK_RUN_FILTER() macro.
>
> Example of internal BPF create, run, destroy:
>
> struct sk_filter *fp;
>
> fp = kzalloc(sk_filter_size(prog_len), GFP_KERNEL);
> memcpy(fp->insni, prog, prog_len * sizeof(fp->insni[0]));
> fp->len = prog_len;
>
> sk_filter_select_runtime(fp);
>
> SK_RUN_FILTER(fp, ctx);
>
> sk_filter_free(fp);
>
> Sockets, seccomp, testsuite, tracing are using different ways to populate
> sk_filter, so first steps of program creation are not common.
>
> Signed-off-by: Alexei Starovoitov <ast@...mgrid.com>
Applied, thank you.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists