[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d520738c0a3f7eb13ce9d7c9a0f6f6e18501a495.camel@huaweicloud.com>
Date: Wed, 07 Sep 2022 08:59:25 +0200
From: Roberto Sassu <roberto.sassu@...weicloud.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Kumar Kartikeya Dwivedi <memxor@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, 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>,
David Howells <dhowells@...hat.com>,
Jarkko Sakkinen <jarkko@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>,
Paul Moore <paul@...l-moore.com>,
James Morris <jmorris@...ei.org>,
"Serge E . Hallyn" <serge@...lyn.com>,
Shuah Khan <shuah@...nel.org>, bpf <bpf@...r.kernel.org>,
keyrings@...r.kernel.org,
LSM List <linux-security-module@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Daniel Müller <deso@...teo.net>,
Roberto Sassu <roberto.sassu@...wei.com>
Subject: Re: [PATCH v16 06/12] bpf: Add bpf_lookup_*_key() and bpf_key_put()
kfuncs
On Tue, 2022-09-06 at 11:45 -0700, Alexei Starovoitov wrote:
> On Tue, Sep 6, 2022 at 1:01 AM Roberto Sassu
> <roberto.sassu@...weicloud.com> wrote:
> > > > +struct bpf_key *bpf_lookup_user_key(u32 serial, u64 flags)
> > > > +{
> > > > + key_ref_t key_ref;
> > > > + struct bpf_key *bkey;
> > > > +
> > > > + if (flags & ~KEY_LOOKUP_ALL)
> > > > + return NULL;
> > > > +
> > > > + /*
> > > > + * Permission check is deferred until the key is used,
> > > > as
> > > > the
> > > > + * intent of the caller is unknown here.
> > > > + */
> > > > + key_ref = lookup_user_key(serial, flags,
> > > > KEY_DEFER_PERM_CHECK);
> > > > + if (IS_ERR(key_ref))
> > > > + return NULL;
> > > > +
> > > > + bkey = kmalloc(sizeof(*bkey), GFP_ATOMIC);
> > >
> > > Since this function (due to lookup_user_key) is sleepable, do we
> > > really need GFP_ATOMIC here?
> >
> > Daniel suggested it for bpf_lookup_system_key(), so that the kfunc
> > does
> > not have to be sleepable.
>
> Hold on. It has to be sleepable. Just take a look
> at what lookup_user_key is doing inside.
>
https://lore.kernel.org/bpf/2b1d62ad-af4b-4694-ecc8-639fbd821a05@iogearbox.net/
Roberto
Powered by blists - more mailing lists