From: Eduard Zingerman <eddyz87@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>, bpf@vger.kernel.org
Cc: daniel@iogearbox.net, andrii@kernel.org, martin.lau@kernel.org,
memxor@gmail.com, kernel-team@fb.com
Subject: Re: [PATCH bpf-next] bpf: Relax precision marking in open coded iters and may_goto loop.
Date: Wed, 22 May 2024 13:18:42 -0700 [thread overview]
Message-ID: <78fa1f7e442579a968a99b00230c6aa0f280679d.camel@gmail.com> (raw)
In-Reply-To: <20240522024713.59136-1-alexei.starovoitov@gmail.com>
On Tue, 2024-05-21 at 19:47 -0700, Alexei Starovoitov wrote:
[...]
Regarding this part, since we discussed it off-list
(I'll continue with the rest of the patch a bit later).
> First of all:
> if (is_may_goto_insn_at(env, insn_idx)) {
> + update_loop_entry(cur, &sl->state);
> if (states_equal(env, &sl->state, cur, RANGE_WITHIN)) {
> - update_loop_entry(cur, &sl->state);
>
> This should be correct, since reaching the same insn should
> satisfy "if h1 in path" requirement of update_loop_entry() algorithm.
> It's too conservative to update loop_entry only on a state match.
So, this basically changes the definition of the verifier states loop.
Previously, we considered a state loop to be such a sequence of states
Si -> ... -> Sj -> ... -> Sk that states_equal(Si, Sk, RANGE_WITHIN)
is true.
With this change Si -> ... -> Sj -> ... Sk is a loop if call sites and
instruction pointers for Si and Sk match.
Whether or not Si and Sk are in the loop influences two things:
(a) if exact comparison is needed for states cache;
(b) if widening transformation could be applied to some scalars.
As far as I understand, all pairs (Si, Sk) marked as a loop using old
definition would be marked as such using new definition
(in a addition to some new pairs).
I think that it is safe to apply (a) and (b) in strictly more cases.
(Although it is probably possible to conjure a program where such
change would hinder verification convergence).
[...]
next prev parent reply other threads:[~2024-05-22 20:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-22 2:47 [PATCH bpf-next] bpf: Relax precision marking in open coded iters and may_goto loop Alexei Starovoitov
2024-05-22 17:33 ` Andrii Nakryiko
2024-05-22 21:09 ` Alexei Starovoitov
2024-05-24 4:19 ` Alexei Starovoitov
2024-05-22 20:18 ` Eduard Zingerman [this message]
2024-05-22 21:13 ` Alexei Starovoitov
2024-05-22 21:54 ` Eduard Zingerman
2024-05-23 0:02 ` Eduard Zingerman
2024-05-23 2:31 ` 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=78fa1f7e442579a968a99b00230c6aa0f280679d.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=martin.lau@kernel.org \
--cc=memxor@gmail.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