[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMEtUuzw8CzUvaNi_OxaChXK0GKVxy5yaK5ztauRf8eiavzGkw@mail.gmail.com>
Date: Sun, 1 Jun 2014 23:33:16 -0700
From: Alexei Starovoitov <ast@...mgrid.com>
To: Daniel Borkmann <dborkman@...hat.com>
Cc: Chema Gonzalez <chema@...gle.com>,
David Miller <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH v2 net-next] net: filter: fix length calculation in BPF testsuite
On Sat, May 31, 2014 at 12:21 PM, Daniel Borkmann <dborkman@...hat.com> wrote:
> On 05/30/2014 07:15 PM, Chema Gonzalez wrote:
>>
>> The current probe_filter_length() (the function that calculates the
>> length of a test BPF filter) behavior is to declare the end of the
>> filter as soon as it finds {0, *, *, 0}. This is actually a valid
>> insn ("ld #0"), so any filter with includes "BPF_STMT(BPF_LD | BPF_IMM,
>> 0)"
>> fails (its length is cut short).
>>
>> We are changing probe_filter_length() so as to start from the end, and
>> declare the end of the filter as the first instruction which is not
>> {0, *, *, 0}. This solution produces a simpler patch than the
>> alternative of using an explicit end-of-filter mark. It is technically
>> incorrect if your filter ends up with "ld #0", but that should not
>> happen anyway.
>>
>> We also add a new test (LD_IMM_0) that includes ld #0 (does not work
>> without this patch).
>>
>> Signed-off-by: Chema Gonzalez <chema@...gle.com>
Thank you for addressing all our comments.
Acked-by: Alexei Starovoitov <ast@...mgrid.com>
>
> Thanks (sorry for the delay as I'm currently on travel).
>
> Acked-by: Daniel Borkmann <dborkman@...hat.com>
--
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