Netdev List
 help / color / mirror / Atom feed
From: Edward Cree <ecree@solarflare.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>
Cc: <netdev@vger.kernel.org>
Subject: [PATCH v2 bpf-next 0/3] bpf/verifier: subprog/func_call simplifications
Date: Thu, 29 Mar 2018 23:44:17 +0100	[thread overview]
Message-ID: <d13f6b60-3632-3e4d-111a-2edb4198b473@solarflare.com> (raw)

By storing subprog boundaries as a subprogno mark on each insn, rather than
 a start (and implicit end) for each subprog, we collect a number of gains:
* More efficient determination of which subprog contains a given insn, and
  thus of find_subprog (which subprog begins at a given insn).
* Number of verifier "full recursive walk" passes is reduced, since most of
  the work is done in the main insn walk (do_check()).  Leftover work in
  other passes is mostly linear scans (O(insn_cnt)) or, in the case of
  check_max_stack_depth(), a topological sort (O(subprog_cnt)).

Some other changes were also included to support this:
* Per-subprog info is stored in env->subprog_info, an array of structs,
  rather than several arrays with a common index.
* Call graph is now stored in the new bpf_subprog_info struct; used here
  for check_max_stack_depth() but may have other uses too.

Along with this, patch #3 puts parent pointers (used by liveness analysis)
 in the registers instead of the func_state or verifier_state, so that we
 don't need skip_callee() machinery.  This also does the right thing for
 stack slots, so they don't need their own special handling for liveness
 marking either.

Edward Cree (3):
  bpf/verifier: validate func_calls by marking at do_check() time
  bpf/verifier: update selftests
  bpf/verifier: per-register parent pointers

 include/linux/bpf_verifier.h                |  32 +-
 kernel/bpf/verifier.c                       | 631 +++++++++++++---------------
 tools/testing/selftests/bpf/test_verifier.c |  51 ++-
 3 files changed, 344 insertions(+), 370 deletions(-)

             reply	other threads:[~2018-03-29 22:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29 22:44 Edward Cree [this message]
2018-03-29 22:45 ` [PATCH v2 bpf-next 1/3] bpf/verifier: validate func_calls by marking at do_check() time Edward Cree
2018-03-29 22:46 ` [PATCH v2 bpf-next 2/3] bpf/verifier: update selftests Edward Cree
2018-03-29 22:46 ` [PATCH v2 bpf-next 3/3] bpf/verifier: per-register parent pointers Edward Cree
2018-03-29 22:50 ` [PATCH v2 bpf-next 0/3] bpf/verifier: subprog/func_call simplifications Edward Cree
2018-04-03  1:08 ` Alexei Starovoitov
2018-04-03 13:39   ` Edward Cree
2018-04-03 23:37     ` Alexei Starovoitov
2018-04-04 23:58       ` Edward Cree
2018-04-05  5:28         ` Alexei Starovoitov
2018-04-05  8:49           ` Edward Cree
2018-04-05 15:50   ` Jiong Wang
2018-04-05 16:29     ` Edward Cree
2018-04-06  1:20     ` 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=d13f6b60-3632-3e4d-111a-2edb4198b473@solarflare.com \
    --to=ecree@solarflare.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=daniel@iogearbox.net \
    --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