All of lore.kernel.org
 help / color / mirror / Atom feed
From: Song Liu <song@kernel.org>
To: Roberto Sassu <roberto.sassu@huaweicloud.com>
Cc: "Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Yonghong Song" <yhs@fb.com>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"KP Singh" <kpsingh@kernel.org>,
	"Stanislav Fomichev" <sdf@google.com>,
	"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
	"Mykola Lysenko" <mykolal@fb.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"David Howells" <dhowells@redhat.com>,
	"Jarkko Sakkinen" <jarkko@kernel.org>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com,
	"Shuah Khan" <shuah@kernel.org>, bpf <bpf@vger.kernel.org>,
	"Linux Doc Mailing List" <linux-doc@vger.kernel.org>,
	keyrings@vger.kernel.org, linux-security-module@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	"open list" <linux-kernel@vger.kernel.org>,
	"Daniel Müller" <deso@posteo.net>,
	"Roberto Sassu" <roberto.sassu@huawei.com>
Subject: Re: [PATCH v13 05/10] bpf: Add bpf_lookup_*_key() and bpf_key_put() kfuncs
Date: Fri, 26 Aug 2022 00:25:41 -0700	[thread overview]
Message-ID: <CAPhsuW76kwaX2mhDtp3_5cC+gxsB3tnVQ00CUrjAR6bFKBcFtQ@mail.gmail.com> (raw)
In-Reply-To: <67c4a5e7cf363a6c9b79a436690c4c3f469652de.camel@huaweicloud.com>

On Fri, Aug 26, 2022 at 12:22 AM Roberto Sassu
<roberto.sassu@huaweicloud.com> wrote:
>
> On Thu, 2022-08-25 at 22:56 -0700, Song Liu wrote:
> > On Tue, Aug 23, 2022 at 8:02 AM Roberto Sassu
> > <roberto.sassu@huaweicloud.com> wrote:
> > > From: Roberto Sassu <roberto.sassu@huawei.com>
> > >
> > > Add the bpf_lookup_user_key(), bpf_lookup_system_key() and
> > > bpf_key_put()
> > > kfuncs, to respectively search a key with a given key handle serial
> > > number
> > > and flags, obtain a key from a pre-determined ID defined in
> > > include/linux/verification.h, and cleanup.
> > >
> > > Introduce system_keyring_id_check() to validate the keyring ID
> > > parameter of
> > > bpf_lookup_system_key().
> > >
> > > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> > > ---
> > >  include/linux/bpf.h          |   6 ++
> > >  include/linux/verification.h |   8 +++
> > >  kernel/trace/bpf_trace.c     | 135
> > > +++++++++++++++++++++++++++++++++++
> > >  3 files changed, 149 insertions(+)
> > >
> > > diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> > > index 6041304b402e..991da09a5858 100644
> > > --- a/include/linux/bpf.h
> > > +++ b/include/linux/bpf.h
> > > @@ -2586,4 +2586,10 @@ static inline void bpf_cgroup_atype_get(u32
> > > attach_btf_id, int cgroup_atype) {}
> > >  static inline void bpf_cgroup_atype_put(int cgroup_atype) {}
> > >  #endif /* CONFIG_BPF_LSM */
> > >
> > > +#ifdef CONFIG_KEYS
> >
> > Do we need to declare struct key here?
> >
> > > +struct bpf_key {
> > > +       struct key *key;
> > > +       bool has_ref;
> > > +};
> > > +#endif /* CONFIG_KEYS */
> > >  #endif /* _LINUX_BPF_H */
> > >
>
> If there is a better place, I will move there.

I guess you misunderstood. I meant we need

struct key;

struct bpf_key {
       struct key *key;
       bool has_ref;
};

Otherwise, we may get some warning with certain config.

Thanks,
Song

  reply	other threads:[~2022-08-26  7:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23 15:00 [PATCH v13 00/10] bpf: Add kfuncs for PKCS#7 signature verification Roberto Sassu
2022-08-23 15:00 ` [PATCH v13 01/10] bpf: Allow kfuncs to be used in LSM programs Roberto Sassu
2022-08-23 15:00 ` [PATCH v13 02/10] btf: Handle dynamic pointer parameter in kfuncs Roberto Sassu
2022-08-26 20:36   ` Kumar Kartikeya Dwivedi
2022-08-23 15:00 ` [PATCH v13 03/10] bpf: Export bpf_dynptr_get_size() Roberto Sassu
2022-08-27 23:33   ` KP Singh
2022-08-23 15:00 ` [PATCH v13 04/10] KEYS: Move KEY_LOOKUP_ to include/linux/key.h Roberto Sassu
2022-08-23 15:00 ` [PATCH v13 05/10] bpf: Add bpf_lookup_*_key() and bpf_key_put() kfuncs Roberto Sassu
2022-08-26  5:56   ` Song Liu
2022-08-26  7:21     ` Roberto Sassu
2022-08-26  7:25       ` Song Liu [this message]
2022-08-26  7:31         ` Roberto Sassu
2022-08-23 15:00 ` [PATCH v13 06/10] bpf: Add bpf_verify_pkcs7_signature() kfunc Roberto Sassu
2022-08-23 15:00 ` [PATCH v13 07/10] selftests/bpf: Compile kernel with everything as built-in Roberto Sassu
2022-08-23 15:00 ` [PATCH v13 08/10] selftests/bpf: Add verifier tests for bpf_lookup_*_key() and bpf_key_put() Roberto Sassu
2022-08-23 15:00 ` [PATCH v13 09/10] selftests/bpf: Add additional tests for bpf_lookup_*_key() Roberto Sassu
2022-08-23 15:00 ` [PATCH v13 10/10] selftests/bpf: Add test for bpf_verify_pkcs7_signature() kfunc Roberto Sassu
2022-08-25  9:19 ` [PATCH v13 00/10] bpf: Add kfuncs for PKCS#7 signature verification Roberto Sassu

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=CAPhsuW76kwaX2mhDtp3_5cC+gxsB3tnVQ00CUrjAR6bFKBcFtQ@mail.gmail.com \
    --to=song@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=daniel@iogearbox.net \
    --cc=deso@posteo.net \
    --cc=dhowells@redhat.com \
    --cc=haoluo@google.com \
    --cc=jarkko@kernel.org \
    --cc=jmorris@namei.org \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=keyrings@vger.kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mingo@redhat.com \
    --cc=mykolal@fb.com \
    --cc=paul@paul-moore.com \
    --cc=roberto.sassu@huawei.com \
    --cc=roberto.sassu@huaweicloud.com \
    --cc=rostedt@goodmis.org \
    --cc=sdf@google.com \
    --cc=serge@hallyn.com \
    --cc=shuah@kernel.org \
    --cc=yhs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.