All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Josef Bacik <jbacik@fb.com>
Cc: jannh@google.com, ast@kernel.org, daniel@iogearbox.net,
	davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH net][v2] bpf: fix range arithmetic for bpf map access
Date: Mon, 14 Nov 2016 19:10:17 -0800	[thread overview]
Message-ID: <20161115031016.GA10323@ast-mbp.thefacebook.com> (raw)
In-Reply-To: <1479156336-6211-1-git-send-email-jbacik@fb.com>

On Mon, Nov 14, 2016 at 03:45:36PM -0500, Josef Bacik wrote:
> I made some invalid assumptions with BPF_AND and BPF_MOD that could result in
> invalid accesses to bpf map entries.  Fix this up by doing a few things
> 
> 1) Kill BPF_MOD support.  This doesn't actually get used by the compiler in real
> life and just adds extra complexity.
> 
> 2) Fix the logic for BPF_AND, don't allow AND of negative numbers and set the
> minimum value to 0 for positive AND's.
> 
> 3) Don't do operations on the ranges if they are set to the limits, as they are
> by definition undefined, and allowing arithmetic operations on those values
> could make them appear valid when they really aren't.
> 
> This fixes the testcase provided by Jann as well as a few other theoretical
> problems.
> 
> Reported-by: Jann Horn <jannh@google.com>
> Signed-off-by: Josef Bacik <jbacik@fb.com>

lgtm.
Acked-by: Alexei Starovoitov <ast@kernel.org>

Jann, could you please double check the logic.
Thanks!

  reply	other threads:[~2016-11-15  3:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 20:45 [PATCH net][v2] bpf: fix range arithmetic for bpf map access Josef Bacik
2016-11-15  3:10 ` Alexei Starovoitov [this message]
2016-11-15 13:47   ` Jann Horn
2016-11-15 14:20     ` Josef Bacik
2016-11-16 18:41       ` Jann Horn
2016-11-16 20:25         ` Josef Bacik
2016-11-16 20:26           ` Jann Horn
2016-11-16 18:22 ` David Miller

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=20161115031016.GA10323@ast-mbp.thefacebook.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=jannh@google.com \
    --cc=jbacik@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.