[PATCH V2] binder: ipc namespace support for android binder

chouryzhou(周威) chouryzhou at tencent.com
Wed Nov 7 01:48:12 UTC 2018


> -----Original Message-----
> From: Andrew Morton <akpm at linux-foundation.org>
> Sent: Wednesday, November 7, 2018 8:07 AM
> To: chouryzhou(周威) <chouryzhou at tencent.com>
> Cc: gregkh at linuxfoundation.org; arve at android.com; tkjos at android.com;
> dave at stgolabs.net; devel at driverdev.osuosl.org; linux-kernel at vger.kernel.org
> Subject: Re: [PATCH V2] binder: ipc namespace support for android
> binder
> 
> On Mon, 29 Oct 2018 06:18:11 +0000 chouryzhou(周威)
> <chouryzhou at tencent.com> wrote:
> 
> >   We are working for running android in container, but we found that binder
> is
> > not isolated by ipc namespace. Since binder is a form of IPC and therefore
> should
> > be tied to ipc namespace. With this patch, we can run more than one android
> > container on one host.
> >   This patch move "binder_procs" and "binder_context" into
> ipc_namespace,
> > driver will find the context from it when opening. Although statistics in
> debugfs
> > remain global.
> >
> > ...
> >
> > --- a/ipc/namespace.c
> > +++ b/ipc/namespace.c
> > @@ -56,6 +56,9 @@ static struct ipc_namespace *create_ipc_ns(struct
> user_namespace *user_ns,
> >         ns->ucounts = ucounts;
> >
> >         err = mq_init_ns(ns);
> > +       if (err)
> > +               goto fail_put;
> > +       err = binder_init_ns(ns);
> >         if (err)
> >                 goto fail_put;
> >
> 
> Don't we need an mq_put_mnt() if binder_init_ns() fails?
> 
> free_ipc_ns() seems to have forgotten about that too.  In which case it
> must be madly leaking mounts so probably I'm wrong.  Confused.
> 

mq_init_ns will do clean job if it failed, and as do binder_init_ns. 


More information about the devel mailing list