Re: [PATCH v8 bpf-next 3/5] bpf: Add skb dynptrs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 26, 2023 at 11:58 PM Martin KaFai Lau <martin.lau@xxxxxxxxx> 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.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux