[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101116221310.GA3058@nuttenaction>
Date: Tue, 16 Nov 2010 23:13:10 +0100
From: Hagen Paul Pfeifer <hagen@...u.net>
To: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc: davem@...emloft.net, eric.dumazet@...il.com,
drosenberg@...curity.com, netdev@...r.kernel.org
Subject: Re: [PATCH] filter: Optimize instruction revalidation code.
* Tetsuo Handa | 2010-11-16 22:08:50 [+0900]:
>--- a/net/core/filter.c
>+++ b/net/core/filter.c
>@@ -383,7 +383,57 @@ EXPORT_SYMBOL(sk_run_filter);
> */
> int sk_chk_filter(struct sock_filter *filter, int flen)
> {
>- struct sock_filter *ftest;
>+ /*
>+ * Valid instructions are initialized to non-0.
>+ * Invalid instructions are initialized to 0.
>+ */
>+ static u16 codes[] = {
>+ [BPF_ALU|BPF_ADD|BPF_K] = BPF_S_ALU_ADD_K + 1,
>+ [BPF_ALU|BPF_ADD|BPF_X] = BPF_S_ALU_ADD_X + 1,
>+ [BPF_ALU|BPF_SUB|BPF_K] = BPF_S_ALU_SUB_K + 1,
[...]
Maybe I don't get it, but you increment the opcode by one, but you never
increment the opcode in sk_run_filter() - do I miss something? Did you test
the your patch (a trivial tcpdump rule should be sufficient)?
If this question is answered (or fixed):
Signed-off-by: Hagen Paul Pfeifer <hagen@...u.net>
HGN
--
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