From: Joanne Koong <joannelkoong@gmail.com>
To: Martin KaFai Lau <martin.lau@linux.dev>
Cc: daniel@iogearbox.net, andrii@kernel.org, martin.lau@kernel.org,
ast@kernel.org, netdev@vger.kernel.org, memxor@gmail.com,
kernel-team@fb.com, bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH v8 bpf-next 3/5] bpf: Add skb dynptrs
Date: Fri, 27 Jan 2023 10:07:32 -0800 [thread overview]
Message-ID: <CAJnrk1bs5y_XDTHYzha_fNVQSbHF6hguewHOd=vm5cnimGTtOw@mail.gmail.com> (raw)
In-Reply-To: <befb819f-abc4-c7a1-1f82-9559542f9138@linux.dev>
On Thu, Jan 26, 2023 at 11:58 PM Martin KaFai Lau <martin.lau@linux.dev> wrote:
>
> On 1/26/23 3:34 PM, Joanne Koong wrote:
> > +static enum bpf_dynptr_type dynptr_get_type(struct bpf_verifier_env *env,
> > + struct bpf_reg_state *reg)
> > +{
> > + struct bpf_func_state *state = func(env, reg);
> > + int spi = __get_spi(reg->off);
> > +
> > + if (spi < 0) {
> > + verbose(env, "verifier internal error: invalid spi when querying dynptr type\n");
> > + return BPF_DYNPTR_TYPE_INVALID;
> > + }
> > +
> > + return state->stack[spi].spilled_ptr.dynptr.type;
> > +}
>
> CI fails:
> https://github.com/kernel-patches/bpf/actions/runs/4020275998/jobs/6908210555
>
> My local KASAN also reports the error.
Ooh thanks for flagging. user_ringbuf() test was failing because
dynptr_get_type didn't account for CONST_PTR_TO_DYNPTR type. This
fixes it:
@@ -6644,8 +6644,12 @@ static enum bpf_dynptr_type
dynptr_get_type(struct bpf_verifier_env *env,
struct bpf_reg_state *reg)
{
struct bpf_func_state *state = func(env, reg);
- int spi = __get_spi(reg->off);
+ int spi;
+
+ if (reg->type == CONST_PTR_TO_DYNPTR)
+ return reg->dynptr.type;
+ spi = __get_spi(reg->off);
if (spi < 0) {
verbose(env, "verifier internal error: invalid spi
when querying dynptr type\n");
I will add this and respin v9.
next prev parent reply other threads:[~2023-01-27 18:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 23:34 [PATCH v8 bpf-next 0/5] Add skb + xdp dynptrs Joanne Koong
2023-01-26 23:34 ` [PATCH v8 bpf-next 1/5] bpf: Allow "sk_buff" and "xdp_buff" as valid kfunc arg types Joanne Koong
2023-01-26 23:34 ` [PATCH v8 bpf-next 2/5] bpf: Allow initializing dynptrs in kfuncs Joanne Koong
2023-01-28 11:52 ` kernel test robot
2023-01-28 14:27 ` kernel test robot
2023-01-26 23:34 ` [PATCH v8 bpf-next 3/5] bpf: Add skb dynptrs Joanne Koong
2023-01-27 7:58 ` Martin KaFai Lau
2023-01-27 18:07 ` Joanne Koong [this message]
2023-01-28 13:15 ` kernel test robot
2023-01-26 23:34 ` [PATCH v8 bpf-next 4/5] bpf: Add xdp dynptrs Joanne Koong
2023-01-28 14:38 ` kernel test robot
2023-01-26 23:34 ` [PATCH v8 bpf-next 5/5] selftests/bpf: tests for using dynptrs to parse skb and xdp buffers Joanne Koong
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='CAJnrk1bs5y_XDTHYzha_fNVQSbHF6hguewHOd=vm5cnimGTtOw@mail.gmail.com' \
--to=joannelkoong@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=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).