From: sdf@google.com
To: Dave Marchevsky <davemarchevsky@fb.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Kernel Team <kernel-team@fb.com>,
Joanne Koong <joannelkoong@gmail.com>
Subject: Re: [PATCH bpf-next] bpf: Add verifier support for custom callback return range
Date: Thu, 8 Sep 2022 16:45:55 -0700 [thread overview]
Message-ID: <Yxp+sw9ivJmmAErV@google.com> (raw)
In-Reply-To: <20220908230716.2751723-1-davemarchevsky@fb.com>
On 09/08, Dave Marchevsky wrote:
> Verifier logic to confirm that a callback function returns 0 or 1 was
> added in commit 69c087ba6225b ("bpf: Add bpf_for_each_map_elem() helper").
> At the time, callback return value was only used to continue or stop
> iteration.
> In order to support callbacks with a broader return value range, such as
> those added in rbtree series[0] and others, add a callback_ret_range to
> bpf_func_state. Verifier's helpers which set in_callback_fn will also
> set the new field, which the verifier will later use to check return
> value bounds.
> Default to tnum_range(0, 0) instead of using tnum_unknown as a sentinel
> value as the latter would prevent the valid range (0, U64_MAX) being
> used. Previous global default tnum_range(0, 1) is explicitly set for
> extant callback helpers. The change to global default was made after
> discussion around this patch in rbtree series [1], goal here is to make
> it more obvious that callback_ret_range should be explicitly set.
> [0]: lore.kernel.org/bpf/20220830172759.4069786-1-davemarchevsky@fb.com/
> [1]: lore.kernel.org/bpf/20220830172759.4069786-2-davemarchevsky@fb.com/
> Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
> ---
> Sending this separately from rbtree patchset as Joanne also needs this
> change for her usecase.
Not sure you need that given everybody's happy about it in the separate
thread, but for the sake of completion:
Reviewed-by: Stanislav Fomichev <sdf@google.com>
next prev parent reply other threads:[~2022-09-08 23:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 23:07 [PATCH bpf-next] bpf: Add verifier support for custom callback return range Dave Marchevsky
2022-09-08 23:45 ` sdf [this message]
2022-09-11 1:20 ` patchwork-bot+netdevbpf
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=Yxp+sw9ivJmmAErV@google.com \
--to=sdf@google.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davemarchevsky@fb.com \
--cc=joannelkoong@gmail.com \
--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