netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: dborkman@redhat.com
Cc: ast@plumgrid.com, netdev@vger.kernel.org
Subject: Re: [PATCH net] net: filter: be more defensive on div/mod by X==0
Date: Mon, 07 Apr 2014 12:55:09 -0400 (EDT)	[thread overview]
Message-ID: <20140407.125509.554303783565384171.davem@davemloft.net> (raw)
In-Reply-To: <1396652643-15647-1-git-send-email-dborkman@redhat.com>

From: Daniel Borkmann <dborkman@redhat.com>
Date: Sat,  5 Apr 2014 01:04:03 +0200

> The old interpreter behaviour was that we returned with 0
> whenever we found a division by 0 would take place. In the new
> interpreter we would currently just skip that instead and
> continue execution.
> 
> It's true that a value of 0 as return might not be appropriate
> in all cases, but current users (socket filters -> drop
> packet, seccomp -> SECCOMP_RET_KILL, cls_bpf -> unclassified,
> etc) seem fine with that behaviour. Better this than undefined
> BPF program behaviour as it's expected that A contains the
> result of the division. In future, as more use cases open up,
> we could further adapt this return value to our needs, if
> necessary.
> 
> So reintroduce return of 0 for division by 0 as in the old
> interpreter. Also in case of K which is guaranteed to be 32bit
> wide, sk_chk_filter() already takes care of preventing division
> by 0 invoked through K, so we can generally spare us these tests.
> 
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> Reviewed-by: Alexei Starovoitov <ast@plumgrid.com>

Applied, thanks Daniel.

      reply	other threads:[~2014-04-07 16:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04 23:04 [PATCH net] net: filter: be more defensive on div/mod by X==0 Daniel Borkmann
2014-04-07 16:55 ` David Miller [this message]

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=20140407.125509.554303783565384171.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ast@plumgrid.com \
    --cc=dborkman@redhat.com \
    --cc=netdev@vger.kernel.org \
    /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).