[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW76kwaX2mhDtp3_5cC+gxsB3tnVQ00CUrjAR6bFKBcFtQ@mail.gmail.com>
Date: Fri, 26 Aug 2022 00:25:41 -0700
From: Song Liu <song@...nel.org>
To: Roberto Sassu <roberto.sassu@...weicloud.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Mykola Lysenko <mykolal@...com>,
Jonathan Corbet <corbet@....net>,
David Howells <dhowells@...hat.com>,
Jarkko Sakkinen <jarkko@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>, paul@...l-moore.com,
jmorris@...ei.org, serge@...lyn.com, Shuah Khan <shuah@...nel.org>,
bpf <bpf@...r.kernel.org>,
Linux Doc Mailing List <linux-doc@...r.kernel.org>,
keyrings@...r.kernel.org, linux-security-module@...r.kernel.org,
linux-kselftest@...r.kernel.org,
open list <linux-kernel@...r.kernel.org>,
Daniel Müller <deso@...teo.net>,
Roberto Sassu <roberto.sassu@...wei.com>
Subject: Re: [PATCH v13 05/10] bpf: Add bpf_lookup_*_key() and bpf_key_put() kfuncs
On Fri, Aug 26, 2022 at 12:22 AM Roberto Sassu
<roberto.sassu@...weicloud.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@...weicloud.com> wrote:
> > > From: Roberto Sassu <roberto.sassu@...wei.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@...wei.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
Powered by blists - more mailing lists