From: Christian Brauner <christian.brauner@ubuntu.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Carlos Llamas" <cmllamas@google.com>,
"Arve Hjønnevåg" <arve@android.com>,
"Todd Kjos" <tkjos@android.com>,
"Martijn Coenen" <maco@android.com>,
"Christian Brauner" <christian@brauner.io>,
"Joel Fernandes" <joel@joelfernandes.org>,
"Steven Moreland" <smoreland@google.com>,
kernel-team@android.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ANDROID: binderfs: add capabilities support
Date: Fri, 9 Jul 2021 10:39:34 +0200 [thread overview]
Message-ID: <20210709083934.ghkohnqq4x23rs7d@wittgenstein> (raw)
In-Reply-To: <YOXdgrmXAMV1ys/A@kroah.com>
On Wed, Jul 07, 2021 at 06:59:46PM +0200, Greg Kroah-Hartman wrote:
> On Wed, Jul 07, 2021 at 04:24:19PM +0000, Carlos Llamas wrote:
> > Provide userspace with a mechanism to discover binder driver
> > capabilities to refrain from using these unsupported features
> > in the first place. Note that older capabilities are assumed
> > to be supported and only new ones will be added.
>
> What defines "new" vs. "old"? Where was the line drawn?
>
> > Signed-off-by: Carlos Llamas <cmllamas@google.com>
> > ---
> > drivers/android/binderfs.c | 45 ++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 45 insertions(+)
> >
> > diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
> > index e80ba93c62a9..f793887f6dc8 100644
> > --- a/drivers/android/binderfs.c
> > +++ b/drivers/android/binderfs.c
> > @@ -58,6 +58,10 @@ enum binderfs_stats_mode {
> > binderfs_stats_mode_global,
> > };
> >
> > +struct binder_capabilities {
> > + bool oneway_spam;
> > +};
> > +
> > static const struct constant_table binderfs_param_stats[] = {
> > { "global", binderfs_stats_mode_global },
> > {}
> > @@ -69,6 +73,10 @@ static const struct fs_parameter_spec binderfs_fs_parameters[] = {
> > {}
> > };
> >
> > +static struct binder_capabilities binder_caps = {
> > + .oneway_spam = true,
> > +};
> > +
> > static inline struct binderfs_info *BINDERFS_SB(const struct super_block *sb)
> > {
> > return sb->s_fs_info;
> > @@ -583,6 +591,39 @@ static struct dentry *binderfs_create_dir(struct dentry *parent,
> > return dentry;
> > }
> >
> > +static int binder_caps_show(struct seq_file *m, void *unused)
> > +{
> > + bool *cap = m->private;
> > +
> > + seq_printf(m, "%d\n", *cap);
> > +
> > + return 0;
> > +}
> > +DEFINE_SHOW_ATTRIBUTE(binder_caps);
> > +
> > +static int init_binder_caps(struct super_block *sb)
> > +{
> > + struct dentry *dentry, *root;
> > + int ret = 0;
> > +
> > + root = binderfs_create_dir(sb->s_root, "caps");
> > + if (IS_ERR(root)) {
> > + ret = PTR_ERR(root);
> > + goto out;
> > + }
> > +
> > + dentry = binderfs_create_file(root, "oneway_spam",
> > + &binder_caps_fops,
> > + &binder_caps.oneway_spam);
> > + if (IS_ERR(dentry)) {
> > + ret = PTR_ERR(dentry);
> > + goto out;
>
> If this fails, you still report that an error happened, yet you do not
> remove the directory? Is that intended?
>
> And where is this new file documented? Where are the existing binderfs
> files documented?
When I wrote it I added documentation to:
Documentation/admin-guide/binderfs.rst
So the new caps directory and file should be documented there.
I would also suggest to add a simple test reading this new caps
directory and the new file in there to:
tools/testing/selftests/filesystems/binderfs_test.c
Christian
next prev parent reply other threads:[~2021-07-09 8:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 16:24 [PATCH] ANDROID: binderfs: add capabilities support Carlos Llamas
2021-07-07 16:59 ` Greg Kroah-Hartman
2021-07-08 16:33 ` Carlos Llamas
2021-07-09 8:39 ` Christian Brauner [this message]
2021-07-09 8:55 ` Christian Brauner
2021-07-09 16:32 ` Carlos Llamas
2021-07-15 3:18 ` [PATCH v2 1/3] binderfs: add support for feature files Carlos Llamas
2021-07-15 3:18 ` [PATCH v2 2/3] docs: binderfs: add section about " Carlos Llamas
2021-07-15 8:08 ` Christian Brauner
2021-07-15 3:18 ` [PATCH v2 3/3] selftests/binderfs: add test for " Carlos Llamas
2021-07-15 8:09 ` Christian Brauner
2021-07-15 8:07 ` [PATCH v2 1/3] binderfs: add support " Christian Brauner
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=20210709083934.ghkohnqq4x23rs7d@wittgenstein \
--to=christian.brauner@ubuntu.com \
--cc=arve@android.com \
--cc=christian@brauner.io \
--cc=cmllamas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=joel@joelfernandes.org \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maco@android.com \
--cc=smoreland@google.com \
--cc=tkjos@android.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 NNTP newsgroup(s).