public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <christian@brauner.io>
To: gregkh@linuxfoundation.org, tkjos@android.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Cc: arve@android.com, maco@android.com, joel@joelfernandes.org,
	Todd Kjos <tkjos@google.com>
Subject: Re: [PATCH v1 1/2] binderfs: implement "max" mount option
Date: Mon, 24 Dec 2018 12:09:37 +0100	[thread overview]
Message-ID: <20181224110935.cop4v5kfcdkemtwo@brauner.io> (raw)
In-Reply-To: <20181223143550.10672-1-christian@brauner.io>

On Sun, Dec 23, 2018 at 03:35:49PM +0100, Christian Brauner wrote:
> Since binderfs can be mounted by userns root in non-initial user namespaces
> some precautions are in order. First, a way to set a maximum on the number
> of binder devices that can be allocated per binderfs instance and second, a
> way to reserve a reasonable chunk of binderfs devices for the initial ipc
> namespace.
> A first approach as seen in [1] used sysctls similiar to devpts but was
> shown to be flawed (cf. [2] and [3]) since some aspects were unneeded. This
> is an alternative approach which avoids sysctls completely and instead
> switches to a single mount option.
> 
> Starting with this commit binderfs instances can be mounted with a limit on
> the number of binder devices that can be allocated. The max=<count> mount
> option serves as a per-instance limit. If max=<count> is set then only
> <count> number of binder devices can be allocated in this binderfs
> instance.
> 
> This allows to safely bind-mount binderfs instances into unprivileged user
> namespaces since userns root in a non-initial user namespace cannot change
> the mount option as long as it does not own the mount namespace the
> binderfs mount was created in and hence cannot drain the host of minor
> device numbers
> 
> [1]: https://lore.kernel.org/lkml/20181221133909.18794-1-christian@brauner.io/
> [2]; https://lore.kernel.org/lkml/20181221163316.GA8517@kroah.com/
> [3]: https://lore.kernel.org/lkml/CAHRSSEx+gDVW4fKKK8oZNAir9G5icJLyodO8hykv3O0O1jt2FQ@mail.gmail.com/
> [4]: https://lore.kernel.org/lkml/20181221192044.5yvfnuri7gdop4rs@brauner.io/
> 
> Cc: Todd Kjos <tkjos@google.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>

Right, I forgot to ask. Do we still have time to land this alongside the
other patches in 4.21? :)

Christian

  parent reply	other threads:[~2018-12-24 11:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-23 14:35 [PATCH v1 1/2] binderfs: implement "max" mount option Christian Brauner
2018-12-23 14:35 ` [PATCH v1 2/2] binderfs: reserve devices for initial mount Christian Brauner
2019-01-03 20:25   ` Todd Kjos
2019-01-03 20:34     ` Christian Brauner
2019-01-03 21:47       ` Todd Kjos
2019-01-03 22:08         ` Christian Brauner
2019-01-03 22:27           ` Todd Kjos
2018-12-24 11:09 ` Christian Brauner [this message]
2018-12-24 11:45   ` [PATCH v1 1/2] binderfs: implement "max" mount option Greg KH
2018-12-24 11:48     ` Christian Brauner
2019-01-02  9:17 ` Dan Carpenter
2019-01-02 11:16   ` 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=20181224110935.cop4v5kfcdkemtwo@brauner.io \
    --to=christian@brauner.io \
    --cc=arve@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@android.com \
    --cc=tkjos@android.com \
    --cc=tkjos@google.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