public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: kernel-janitors@vger.kernel.org
Subject: Re: [bug report] bpf/verifier: track liveness for pruning
Date: Thu, 17 Aug 2017 12:00:00 +0000	[thread overview]
Message-ID: <59958540.20000@iogearbox.net> (raw)
In-Reply-To: <20170817074415.s24acvnsrask6ue2@mwanda>

On 08/17/2017 09:44 AM, Dan Carpenter wrote:
> Hello Edward Cree,
>
> The patch dc503a8ad984: "bpf/verifier: track liveness for pruning"
> from Aug 15, 2017, leads to the following static checker warning:
>
> 	kernel/bpf/verifier.c:3463 do_propagate_liveness()
> 	error: buffer overflow 'parent->regs' 11 <= 63

This should be the below. Will submit a proper one after some tests.

Thanks for spotting!

 From 385a1a9f16bf70e0139b38a68252380d6380e003 Mon Sep 17 00:00:00 2001
Message-Id: <385a1a9f16bf70e0139b38a68252380d6380e003.1502971079.git.daniel@iogearbox.net>
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Thu, 17 Aug 2017 13:57:38 +0200
Subject: [PATCH net-next] bpf: fix liveness propagation to parent in stack slots

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
  kernel/bpf/verifier.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 958ba84..40f669d 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -3460,7 +3460,7 @@ static bool do_propagate_liveness(const struct bpf_verifier_state *state,
  		if (parent->spilled_regs[i].live & REG_LIVE_READ)
  			continue;
  		if (state->spilled_regs[i].live = REG_LIVE_READ) {
-			parent->regs[i].live |= REG_LIVE_READ;
+			parent->spilled_regs[i].live |= REG_LIVE_READ;
  			touched = true;
  		}
  	}
-- 
1.9.3



  reply	other threads:[~2017-08-17 12:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-17  7:44 [bug report] bpf/verifier: track liveness for pruning Dan Carpenter
2017-08-17 12:00 ` Daniel Borkmann [this message]
2017-08-17 12:53 ` Edward Cree

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=59958540.20000@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=kernel-janitors@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