BPF List
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Andrii Nakryiko <andrii@kernel.org>,
	bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net
Cc: andrii@kernel.org, kernel-team@fb.com
Subject: RE: [PATCH bpf-next 1/3] bpf: decouple prune and jump points
Date: Tue, 06 Dec 2022 13:42:03 -0800	[thread overview]
Message-ID: <638fb72bec402_8a9120872@john.notmuch> (raw)
In-Reply-To: <20221202051030.3100390-2-andrii@kernel.org>

Andrii Nakryiko wrote:
> BPF verifier marks some instructions as prune points. Currently these
> prune points serve two purposes.
> 
> It's a point where verifier tries to find previously verified state and
> check current state's equivalence to short circuit verification for
> current code path.
> 
> But also currently it's a point where jump history, used for precision
> backtracking, is updated. This is done so that non-linear flow of
> execution could be properly backtracked.
> 
> Such coupling is coincidental and unnecessary. Some prune points are not
> part of some non-linear jump path, so don't need update of jump history.
> On the other hand, not all instructions which have to be recorded in
> jump history necessarily are good prune points.
> 
> This patch splits prune and jump points into independent flags.
> Currently all prune points are marked as jump points to minimize amount
> of changes in this patch, but next patch will perform some optimization
> of prune vs jmp point placement.
> 
> No functional changes are intended.
> 
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>

Acked-by: John Fastabend <john.fastabend@gmail.com>

> ---
>  include/linux/bpf_verifier.h |  1 +
>  kernel/bpf/verifier.c        | 57 +++++++++++++++++++++++++++---------
>  2 files changed, 44 insertions(+), 14 deletions(-)
> 
> diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
> index b5090e89cb3f..9870d1d0df01 100644
> --- a/include/linux/bpf_verifier.h
> +++ b/include/linux/bpf_verifier.h
> @@ -452,6 +452,7 @@ struct bpf_insn_aux_data {
>  	/* below fields are initialized once */
>  	unsigned int orig_idx; /* original instruction index */
>  	bool prune_point;
> +	bool jmp_point;

Random thought we might want to make these flags in the future so you
can have,

   type = BPF_PRUNE_POINT | BPF_JMP_POINT | BPF_ITERATOR_POINT

and so on without a bunch of bools.

>  };
>  

  reply	other threads:[~2022-12-06 21:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02  5:10 [PATCH bpf-next 0/3] Refactor verifier prune and jump point handling Andrii Nakryiko
2022-12-02  5:10 ` [PATCH bpf-next 1/3] bpf: decouple prune and jump points Andrii Nakryiko
2022-12-06 21:42   ` John Fastabend [this message]
2022-12-06 23:05     ` Andrii Nakryiko
2022-12-02  5:10 ` [PATCH bpf-next 2/3] bpf: mostly decouple jump history management from is_state_visited() Andrii Nakryiko
2022-12-06 22:01   ` John Fastabend
2022-12-02  5:10 ` [PATCH bpf-next 3/3] bpf: remove unnecessary prune and jump points Andrii Nakryiko
2022-12-06 22:19   ` John Fastabend
2022-12-06 23:19     ` Andrii Nakryiko

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=638fb72bec402_8a9120872@john.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox