Re: [PATCH v8 bpf-next 1/9] bpf: Add __bpf_dynptr_data* for in kernel use

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

 



Hi Roberto,

On Thu, Nov 2, 2023 at 3:59 PM Song Liu <song@xxxxxxxxxx> wrote:
>
> On Thu, Nov 2, 2023 at 1:16 PM Song Liu <song@xxxxxxxxxx> wrote:
> >
> [...]
> > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> > index df697c74d519..92dc20d9b9ae 100644
> > --- a/kernel/trace/bpf_trace.c
> > +++ b/kernel/trace/bpf_trace.c
> > @@ -1378,6 +1378,7 @@ __bpf_kfunc int bpf_verify_pkcs7_signature(struct bpf_dynptr_kern *data_ptr,
> >                                struct bpf_dynptr_kern *sig_ptr,
> >                                struct bpf_key *trusted_keyring)
> >  {
> > +       void *data, *sig;
> >         int ret;
> >
> >         if (trusted_keyring->has_ref) {
> > @@ -1394,10 +1395,14 @@ __bpf_kfunc int bpf_verify_pkcs7_signature(struct bpf_dynptr_kern *data_ptr,
> >                         return ret;
> >         }
> >
> > -       return verify_pkcs7_signature(data_ptr->data,
> > -                                     __bpf_dynptr_size(data_ptr),
> > -                                     sig_ptr->data,
> > -                                     __bpf_dynptr_size(sig_ptr),
> > +       data = __bpf_dynptr_data(data_ptr, __bpf_dynptr_size(data_ptr));
> > +       sig = __bpf_dynptr_data(sig_ptr, __bpf_dynptr_size(sig_ptr));
> > +
> > +       if (!data || !sig)
> > +               return -EINVAL;
>
> Sigh, I missed this failure:
>
> https://github.com/kernel-patches/bpf/actions/runs/6737884115/job/18316480188
>
> #110/1 kfunc_dynptr_param/dynptr_data_null
> ...
> verify_success:FAIL:err unexpected err: actual -22 != expected -74
>
> It is easy to fix, but I am not sure which is the right fix.
>
> Basically, null dynptr bpf_verify_pkcs7_signature used to return
> -EBADMSG. And it
> is returning -EINVAL after this change. Do we need to keep the error code as
> -EBADMSG?

Could you please share your thoughts on this (EINVAL vs. EBADMSG)?

Thanks,
Song





[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