From: Eduard Zingerman <eddyz87@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@linux.dev>,
Kernel Team <kernel-team@fb.com>,
Yonghong Song <yonghong.song@linux.dev>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Andrew Werner <awerner32@gmail.com>
Subject: Re: [PATCH bpf v2 10/11] bpf: keep track of max number of bpf_loop callback iterations
Date: Mon, 20 Nov 2023 04:06:30 +0200 [thread overview]
Message-ID: <3f21d362899947f716a0cfa93b9c22bcec66afd8.camel@gmail.com> (raw)
In-Reply-To: <CAADnVQ+Zit-KLSnoo0x-dh7Ek-VGm1K0-oBWZ085dke-ztYLMg@mail.gmail.com>
On Sun, 2023-11-19 at 18:00 -0800, Alexei Starovoitov wrote:
> On Fri, Nov 17, 2023 at 5:34 PM Eduard Zingerman <eddyz87@gmail.com> wrote:
> >
> > diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
> > index 7def320aceef..71b7c7c39cea 100644
> > --- a/include/linux/bpf_verifier.h
> > +++ b/include/linux/bpf_verifier.h
> > @@ -301,6 +301,15 @@ struct bpf_func_state {
> > struct tnum callback_ret_range;
> > bool in_async_callback_fn;
> > bool in_exception_callback_fn;
> > + /* For callback calling functions that limit number of possible
> > + * callback executions (e.g. bpf_loop) keeps track of current
> > + * simulated iteration number. When non-zero either:
> > + * - current frame has a child frame, in such case it's callsite points
> > + * to callback calling function;
> > + * - current frame is a topmost frame, in such case callback has just
> > + * returned and env->insn_idx points to callback calling function.
> > + */
> > + u32 callback_depth;
>
> The first part of the comment makes sense, but the second...
> What are you trying to explain with the second part ?
> How does the knowledge of insn_idx help here ? or helps to
> understand the rest of the patch?
The intent was to explain that 'callback_depth' in frame N refers to
number of times callback with frame N+1 was simulated, e.g.:
bpf_loop(..., fn, ...); | suppose current frame is N
| fn would be simulated in frame N+1
| number of simulations is tracked in frame N
next prev parent reply other threads:[~2023-11-20 2:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-18 1:33 [PATCH bpf v2 00/11] verify callbacks as if they are called unknown number of times Eduard Zingerman
2023-11-18 1:33 ` [PATCH bpf v2 01/11] selftests/bpf: track tcp payload offset as scalar in xdp_synproxy Eduard Zingerman
2023-11-18 1:33 ` [PATCH bpf v2 02/11] selftests/bpf: track string payload offset as scalar in strobemeta Eduard Zingerman
2023-11-18 1:33 ` [PATCH bpf v2 03/11] selftests/bpf: fix bpf_loop_bench for new callback verification scheme Eduard Zingerman
2023-11-18 1:33 ` [PATCH bpf v2 04/11] bpf: extract __check_reg_arg() utility function Eduard Zingerman
2023-11-18 1:33 ` [PATCH bpf v2 05/11] bpf: extract setup_func_entry() " Eduard Zingerman
2023-11-18 1:33 ` [PATCH bpf v2 06/11] bpf: verify callbacks as if they are called unknown number of times Eduard Zingerman
2023-11-20 1:41 ` Alexei Starovoitov
2023-11-20 1:46 ` Eduard Zingerman
2023-11-18 1:33 ` [PATCH bpf v2 07/11] selftests/bpf: tests for iterating callbacks Eduard Zingerman
2023-11-18 1:33 ` [PATCH bpf v2 08/11] bpf: widening for callback iterators Eduard Zingerman
2023-11-18 1:33 ` [PATCH bpf v2 09/11] selftests/bpf: test widening for iterating callbacks Eduard Zingerman
2023-11-18 1:33 ` [PATCH bpf v2 10/11] bpf: keep track of max number of bpf_loop callback iterations Eduard Zingerman
2023-11-20 2:00 ` Alexei Starovoitov
2023-11-20 2:06 ` Eduard Zingerman [this message]
2023-11-20 2:11 ` Alexei Starovoitov
2023-11-18 1:33 ` [PATCH bpf v2 11/11] selftests/bpf: check if max number of bpf_loop iterations is tracked Eduard Zingerman
2023-11-20 2:09 ` Alexei Starovoitov
2023-11-20 2:23 ` 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=3f21d362899947f716a0cfa93b9c22bcec66afd8.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=awerner32@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--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