All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Paul Chaignon <paul.chaignon@orange.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>
Cc: "xiao.han@orange.com" <xiao.han@orange.com>,
	"paul.chaignon@gmail.com" <paul.chaignon@gmail.com>,
	Martin Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>
Subject: Re: [PATCH bpf-next 0/2] bpf: remove incorrect 'verifier bug' warning
Date: Wed, 20 Mar 2019 23:31:54 +0000	[thread overview]
Message-ID: <e84ec4b3-ea21-a2ed-d6fb-1c899ef748d0@fb.com> (raw)
In-Reply-To: <cover.1553085539.git.paul.chaignon@orange.com>



On 3/20/19 5:57 AM, Paul Chaignon wrote:
> The BPF verifier checks the maximum number of call stack frames twice,
> first in the main CFG traversal (do_check) and then in a subsequent
> traversal (check_max_stack_depth).  If the second check fails, it logs a
> 'verifier bug' warning and errors out, as the number of call stack frames
> should have been verified already.
> 
> However, the second check may fail without indicating a verifier bug: if
> the excessive function calls reside in dead code, the main CFG traversal
> may not visit them; the subsequent traversal visits all instructions,
> including dead code.
> 
> This case raises the question of how invalid dead code should be treated.

Maybe we should do this check after dead code elimination to be 
consistent with do_check? There could some other kinds of illegal stuff
in the dead code, e.g., illegal/unsupported helpers, etc. I suppose we 
did not warn or reject the program, right?

> The first patch implements the conservative option and rejects such code;
> the second adds a test case.
> 
> Paul Chaignon (2):
>    bpf: remove incorrect 'verifier bug' warning
>    selftests/bpf: test case for invalid call stack in dead code
> 
>   kernel/bpf/verifier.c                        |  5 +--
>   tools/testing/selftests/bpf/verifier/calls.c | 38 ++++++++++++++++++++
>   2 files changed, 41 insertions(+), 2 deletions(-)
> 

  parent reply	other threads:[~2019-03-20 23:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 12:57 [PATCH bpf-next 0/2] bpf: remove incorrect 'verifier bug' warning Paul Chaignon
2019-03-20 12:58 ` [PATCH bpf-next 1/2] " Paul Chaignon
2019-03-20 12:58 ` [PATCH bpf-next 2/2] selftests/bpf: test case for invalid call stack in dead code Paul Chaignon
2019-03-20 23:31 ` Yonghong Song [this message]
2019-03-21  9:33   ` [PATCH bpf-next 0/2] bpf: remove incorrect 'verifier bug' warning Paul Chaignon
2019-03-26 20:07     ` Alexei Starovoitov

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=e84ec4b3-ea21-a2ed-d6fb-1c899ef748d0@fb.com \
    --to=yhs@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=paul.chaignon@gmail.com \
    --cc=paul.chaignon@orange.com \
    --cc=songliubraving@fb.com \
    --cc=xiao.han@orange.com \
    /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.