BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Daniel Borkmann <daniel@iogearbox.net>,
	 Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@kernel.org>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Kernel Team <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 14:54:55 -0700	[thread overview]
Message-ID: <2b64287f18f11fc5d9e8a8c834da6d010a92e5b1.camel@gmail.com> (raw)
In-Reply-To: <CAADnVQJ_c0XTsNY_bfHL0qWfzpEdgy+-mJ1oqtHVppvxA2_TCw@mail.gmail.com>

On Wed, 2024-05-22 at 14:13 -0700, Alexei Starovoitov wrote:

[...]

> Agree with this conclusion.
> As discussed offlist we can add a check that
> Si->parent->parent...->parent == Sk.
> to make the algorithm "by the book".
> I'll play with that.

Actually, I don't think this is necessary, here is the code for
update_loop_entry():

    static void update_loop_entry(struct bpf_verifier_state *cur,
                                  struct bpf_verifier_state *hdr)
    {
            struct bpf_verifier_state *cur1, *hdr1;

            cur1 = get_loop_entry(cur) ?: cur;
            hdr1 = get_loop_entry(hdr) ?: hdr;
            if (hdr1->branches && hdr1->dfs_depth <= cur1->dfs_depth) {
                    cur->loop_entry = hdr;
                    hdr->used_as_loop_entry = true;
            }
    }
    
It relies on the following properties:
- every state in the current DFS path (except current)
  has branches > 0;
- states not in the DFS path are either:
  - in explored_states, are fully explored and have branches == 0;
  - in env->stack, are not yet explored and have branches == 0
    (and also not reachable from is_state_visited()).

So, I don't think there is a need to check that hdr1 is in the parent
chain for cur1.

  reply	other threads:[~2024-05-22 21:54 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
2024-05-22 21:13   ` Alexei Starovoitov
2024-05-22 21:54     ` Eduard Zingerman [this message]
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=2b64287f18f11fc5d9e8a8c834da6d010a92e5b1.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