netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hagen Paul Pfeifer <hagen@jauu.net>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: davem@davemloft.net, eric.dumazet@gmail.com,
	drosenberg@vsecurity.com, netdev@vger.kernel.org
Subject: Re: [PATCH] filter: Optimize instruction revalidation code.
Date: Tue, 16 Nov 2010 23:13:10 +0100	[thread overview]
Message-ID: <20101116221310.GA3058@nuttenaction> (raw)
In-Reply-To: <201011162208.BHC17628.SVtFMJOOLFQFOH@I-love.SAKURA.ne.jp>

* 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@jauu.net>

HGN

  parent reply	other threads:[~2010-11-16 22:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10 18:18 [PATCH] Prevent reading uninitialized memory with socketfilters Dan Rosenberg
2010-11-10 18:21 ` David Miller
2010-11-10 18:33   ` Eric Dumazet
2010-11-10 18:38     ` David Miller
2010-11-16 13:08       ` [PATCH] filter: Optimize instruction revalidation code Tetsuo Handa
2010-11-16 13:11         ` Michael Tokarev
2010-11-16 13:44         ` Eric Dumazet
2010-11-16 14:31           ` [PATCH v2] " Tetsuo Handa
2010-11-16 16:30             ` Eric Dumazet
2010-11-17  1:19               ` [PATCH v3] " Tetsuo Handa
2010-11-17  7:48                 ` Eric Dumazet
2010-11-17  7:54                   ` Changli Gao
2010-11-17  8:18                     ` Eric Dumazet
2010-11-17  8:06                   ` Tetsuo Handa
2010-11-17  9:01                     ` Hagen Paul Pfeifer
2010-11-18 18:58                 ` David Miller
2010-11-16 22:13         ` Hagen Paul Pfeifer [this message]
2010-11-16 23:31           ` [PATCH] " Changli Gao
2010-11-16 23:45             ` Hagen Paul Pfeifer
2010-11-16 23:24         ` Changli Gao

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=20101116221310.GA3058@nuttenaction \
    --to=hagen@jauu.net \
    --cc=davem@davemloft.net \
    --cc=drosenberg@vsecurity.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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;
as well as URLs for NNTP newsgroup(s).