From: KP Singh <kpsingh@kernel.org>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Song Liu <song@kernel.org>, bpf <bpf@vger.kernel.org>,
fsverity@lists.linux.dev, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@kernel.org>,
Kernel Team <kernel-team@meta.com>,
Eric Biggers <ebiggers@kernel.org>,
"Theodore Ts'o" <tytso@mit.edu>,
Roberto Sassu <roberto.sassu@huaweicloud.com>
Subject: Re: [PATCH bpf-next 1/5] bpf: Add kfunc bpf_get_file_xattr
Date: Thu, 2 Nov 2023 02:19:33 +0100 [thread overview]
Message-ID: <CACYkzJ4=8TwRS4xGm3G81LtkYLWtwZY0G2OvK25TTrF5Fyppwg@mail.gmail.com> (raw)
In-Reply-To: <CAADnVQLcrxLatupH=i2Q-K8KRF72PqB8wayC=UEKvuMMn3ie7A@mail.gmail.com>
On Tue, Oct 17, 2023 at 9:11 PM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Fri, Oct 13, 2023 at 11:30 AM Song Liu <song@kernel.org> wrote:
> > +__bpf_kfunc int bpf_get_file_xattr(struct file *file, struct bpf_dynptr_kern *name_ptr,
> > + struct bpf_dynptr_kern *value_ptr)
> > +{
> > + if (!bpf_dynptr_is_string(name_ptr))
> > + return -EINVAL;
> > +
> > + return vfs_getxattr(mnt_idmap(file->f_path.mnt), file_dentry(file), name_ptr->data,
> > + value_ptr->data, __bpf_dynptr_size(value_ptr));
> > +}
> > +
> > +__diag_pop();
> > +
> > +BTF_SET8_START(fs_kfunc_set)
> > +BTF_ID_FLAGS(func, bpf_get_file_xattr, KF_SLEEPABLE)
>
> I suspect it needs to be allowlisted too.
> Sleepable might not be enough.
>
> KP proposed such kfunc in the past and there were recursion issues.
>
> KP,
> do you remember the details?
yeah, have a look at Al's reply:
https://lore.kernel.org/bpf/Yrs4+ThR4ACb5eD%2F@ZenIV/
it can create deadlocks and potentially UAFs (similar to the situation
Jann mentioned). This will need to be allowlisted.
next prev parent reply other threads:[~2023-11-02 1:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-13 18:26 [PATCH bpf-next 0/5] bpf: file verification with LSM and fsverity Song Liu
2023-10-13 18:26 ` [PATCH bpf-next 1/5] bpf: Add kfunc bpf_get_file_xattr Song Liu
2023-10-17 18:58 ` Andrii Nakryiko
2023-10-17 20:31 ` Song Liu
2023-10-17 21:52 ` Andrii Nakryiko
2023-10-17 22:16 ` Song Liu
2023-10-17 22:40 ` Andrii Nakryiko
2023-10-17 22:46 ` Song Liu
2023-10-18 1:42 ` Hou Tao
2023-10-17 19:10 ` Alexei Starovoitov
2023-11-02 1:19 ` KP Singh [this message]
2023-10-13 18:26 ` [PATCH bpf-next 2/5] bpf, fsverity: Add kfunc bpf_get_fsverity_digest Song Liu
2023-10-15 7:07 ` Eric Biggers
2023-10-16 20:10 ` Song Liu
2023-10-17 3:12 ` Eric Biggers
2023-10-17 5:35 ` Song Liu
2023-10-17 5:46 ` Eric Biggers
2023-10-17 14:16 ` Song Liu
2023-10-17 19:50 ` Andrii Nakryiko
2023-10-13 18:26 ` [PATCH bpf-next 3/5] selftests/bpf: Sort config in alphabetic order Song Liu
2023-10-13 18:26 ` [PATCH bpf-next 4/5] selftests/bpf: Add tests for filesystem kfuncs Song Liu
2023-10-13 18:26 ` [PATCH bpf-next 5/5] selftests/bpf: Add test that use fsverity and xattr to sign a file Song Liu
2023-10-17 19:08 ` Alexei Starovoitov
2023-10-17 20:36 ` 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='CACYkzJ4=8TwRS4xGm3G81LtkYLWtwZY0G2OvK25TTrF5Fyppwg@mail.gmail.com' \
--to=kpsingh@kernel.org \
--cc=alexei.starovoitov@gmail.com \
--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=martin.lau@kernel.org \
--cc=roberto.sassu@huaweicloud.com \
--cc=song@kernel.org \
--cc=tytso@mit.edu \
/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).