fsverity.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Song Liu <song@kernel.org>
To: roberto.sassu@huaweicloud.com
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	 martin.lau@kernel.org, kernel-team@meta.com,
	ebiggers@kernel.org,  tytso@mit.edu, vadfed@meta.com,
	kpsingh@kernel.org, bpf@vger.kernel.org,
	 fsverity@lists.linux.dev
Subject: Re: [PATCH v8 bpf-next 1/9] bpf: Add __bpf_dynptr_data* for in kernel use
Date: Thu, 2 Nov 2023 16:53:55 -0700	[thread overview]
Message-ID: <CAPhsuW5+rFanHxuXADDHYheeAwt0bvKdLcxwO=ysCeK+kWdOjQ@mail.gmail.com> (raw)
In-Reply-To: <CAPhsuW68DMvSSu9JVfJLWiRjrSWbhOmza2ivd6Dmh22oogM7eA@mail.gmail.com>

Hi Roberto,

On Thu, Nov 2, 2023 at 3:59 PM Song Liu <song@kernel.org> wrote:
>
> On Thu, Nov 2, 2023 at 1:16 PM Song Liu <song@kernel.org> 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

  reply	other threads:[~2023-11-02 23:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02 20:16 [PATCH v8 bpf-next 0/9] bpf: File verification with LSM and fsverity Song Liu
2023-11-02 20:16 ` [PATCH v8 bpf-next 1/9] bpf: Add __bpf_dynptr_data* for in kernel use Song Liu
2023-11-02 22:59   ` Song Liu
2023-11-02 23:53     ` Song Liu [this message]
2023-11-02 20:16 ` [PATCH v8 bpf-next 2/9] bpf: Factor out helper check_reg_const_str() Song Liu
2023-11-02 20:16 ` [PATCH v8 bpf-next 3/9] bpf: Introduce KF_ARG_PTR_TO_CONST_STR Song Liu
2023-11-02 20:16 ` [PATCH v8 bpf-next 4/9] bpf: Add kfunc bpf_get_file_xattr Song Liu
2023-11-02 20:16 ` [PATCH v8 bpf-next 5/9] bpf, fsverity: Add kfunc bpf_get_fsverity_digest Song Liu
2023-11-02 20:16 ` [PATCH v8 bpf-next 6/9] Documentation/bpf: Add documentation for filesystem kfuncs Song Liu
2023-11-02 20:16 ` [PATCH v8 bpf-next 7/9] selftests/bpf: Sort config in alphabetic order Song Liu
2023-11-02 20:16 ` [PATCH v8 bpf-next 8/9] selftests/bpf: Add tests for filesystem kfuncs Song Liu
2023-11-02 20:16 ` [PATCH v8 bpf-next 9/9] selftests/bpf: Add test that uses fsverity and xattr to sign a file Song Liu

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='CAPhsuW5+rFanHxuXADDHYheeAwt0bvKdLcxwO=ysCeK+kWdOjQ@mail.gmail.com' \
    --to=song@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=ebiggers@kernel.org \
    --cc=fsverity@lists.linux.dev \
    --cc=kernel-team@meta.com \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=roberto.sassu@huaweicloud.com \
    --cc=tytso@mit.edu \
    --cc=vadfed@meta.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).