From: Eduard Zingerman <eddyz87@gmail.com>
To: Yonghong Song <yonghong.song@linux.dev>,
bpf@vger.kernel.org, ast@kernel.org
Cc: andrii@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev,
kernel-team@fb.com, kuniyu@amazon.com
Subject: Re: [PATCH bpf-next 2/3] bpf: check bpf_func_state->callback_depth when pruning states
Date: Fri, 16 Feb 2024 16:27:44 +0200 [thread overview]
Message-ID: <9e19786565a3fbfea58dcd25bba644fe8e0ed6b0.camel@gmail.com> (raw)
In-Reply-To: <1fbcd9f1-6c83-4430-b797-a92285d1d151@linux.dev>
On Wed, 2024-02-14 at 09:42 -0800, Yonghong Song wrote:
> > .------------------------------------- Checkpoint / State name
> > | .-------------------------------- Code point number
> > | | .---------------------------- Stack state {ctx.a,ctx.b,ctx.c}
> > | | | .------------------- Callback depth in frame #0
> > v v v v
> > 1 - (0) {7P,7P,7},depth=0
> > 2 - (3) {7P,7P,7},depth=1
> > 3 - (0) {7P,7P,42},depth=1
> > (a) - (3) {7P,7,42},depth=2
> > 4 - (0) {7P,7,42},depth=2 loop terminates because of depth limit
> > 5 - (4) {7P,7,42},depth=0 predicted false, ctx.a marked precise
> > 6 - (6) exit
> > 7 - (2) {7P,7,42},depth=2
> > 8 - (0) {7P,42,42},depth=2 loop terminates because of depth limit
> > 9 - (4) {7P,42,42},depth=0 predicted false, ctx.a marked precise
> > 10 - (6) exit
> > (b) - (1) {7P,7P,42},depth=2
> > 11 - (0) {42P,7P,42},depth=2 loop terminates because of depth limit
> > 12 - (4) {42P,7P,42},depth=0 predicted false, ctx.{a,b} marked precise
> > 13 - (6) exit
> > 14 - (2) {7P,7,7},depth=1
> > 15 - (0) {7P,42,7},depth=1 considered safe, pruned using checkpoint (a)
> > (c) - (1) {7P,7P,7},depth=1 considered safe, pruned using checkpoint (b)
>
> For the above line
> (c) - (1) {7P,7P,7},depth=1 considered safe, pruned using checkpoint (b)
> I would change to
> (c) - (1) {7P,7P,7},depth=1
> - (0) {42P, 7P, 7},depth = 1 considered safe, pruned using checkpoint (11)
At that point:
- there is a checkpoint at (1) with state {7P,7P,42}
- verifier is at (1) in state {7,7,7}
Thus, verifier won't proceed to (0) because {7,7,7} is states_equal to {7P,7P,42}.
> For
> 14 - (2) {7P,7,7},depth=1
> 15 - (0) {7P,42,7},depth=1 considered safe, pruned using checkpoint (a)
> I suspect for line 15, the pruning uses checking point at line (8).
Right, because checkpoints for a particular insn form a stack. My bad.
> Other than the above, the diagram LGTM.
Thank you for the feedback, I'll post v2 shortly.
next prev parent reply other threads:[~2024-02-16 14:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-12 14:38 [PATCH bpf-next 0/3] check bpf_func_state->callback_depth when pruning states Eduard Zingerman
2024-02-12 14:38 ` [PATCH bpf-next 1/3] selftests/bpf: update tcp_custom_syncookie to use scalar packet offset Eduard Zingerman
2024-02-12 23:58 ` Yonghong Song
2024-02-12 14:38 ` [PATCH bpf-next 2/3] bpf: check bpf_func_state->callback_depth when pruning states Eduard Zingerman
2024-02-13 1:20 ` Yonghong Song
2024-02-13 14:21 ` Eduard Zingerman
2024-02-13 18:14 ` Eduard Zingerman
2024-02-14 17:42 ` Yonghong Song
2024-02-16 14:27 ` Eduard Zingerman [this message]
2024-02-20 0:25 ` Yonghong Song
2024-02-20 17:13 ` Eduard Zingerman
2024-02-12 14:38 ` [PATCH bpf-next 3/3] selftests/bpf: test case for callback_depth states pruning logic Eduard Zingerman
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=9e19786565a3fbfea58dcd25bba644fe8e0ed6b0.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=kuniyu@amazon.com \
--cc=martin.lau@linux.dev \
--cc=yonghong.song@linux.dev \
/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