Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-12-07 Thread Serge Hallyn
Quoting Tejun Heo (t...@kernel.org): > Hello, Serge. > > On Thu, Dec 03, 2015 at 04:47:06PM -0600, Serge E. Hallyn wrote: > ... > > + dentry = dget(sb->s_root); > > + if (!kn->parent) // this is the root > > + return dentry; > > + > > + knparent = find_kn_ancestor_below(kn, NULL);

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-12-07 Thread Tejun Heo
Hello, Serge. On Thu, Dec 03, 2015 at 04:47:06PM -0600, Serge E. Hallyn wrote: ... > + dentry = dget(sb->s_root); > + if (!kn->parent) // this is the root > + return dentry; > + > + knparent = find_kn_ancestor_below(kn, NULL); > + BUG_ON(!knparent); Doing WARN_ON() and

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-12-03 Thread Serge E. Hallyn
On Wed, Dec 02, 2015 at 12:05:51PM -0500, Tejun Heo wrote: > On Wed, Dec 02, 2015 at 11:02:39AM -0600, Serge E. Hallyn wrote: > > On Wed, Dec 02, 2015 at 11:58:39AM -0500, Tejun Heo wrote: > > > On Wed, Dec 02, 2015 at 10:56:37AM -0600, Serge E. Hallyn wrote: > > > > Can it be flushed when we know

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-12-02 Thread Tejun Heo
On Wed, Dec 02, 2015 at 11:02:39AM -0600, Serge E. Hallyn wrote: > On Wed, Dec 02, 2015 at 11:58:39AM -0500, Tejun Heo wrote: > > On Wed, Dec 02, 2015 at 10:56:37AM -0600, Serge E. Hallyn wrote: > > > Can it be flushed when we know that the cgroup is being pinned by > > > a css_set? (There's eithe

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-12-02 Thread Serge E. Hallyn
On Wed, Dec 02, 2015 at 11:58:39AM -0500, Tejun Heo wrote: > On Wed, Dec 02, 2015 at 10:56:37AM -0600, Serge E. Hallyn wrote: > > Can it be flushed when we know that the cgroup is being pinned by > > a css_set? (There's either a task or a cgroup_namespace pinning it > > or we wouldn't get here) >

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-12-02 Thread Tejun Heo
On Wed, Dec 02, 2015 at 10:56:37AM -0600, Serge E. Hallyn wrote: > Can it be flushed when we know that the cgroup is being pinned by > a css_set? (There's either a task or a cgroup_namespace pinning it > or we wouldn't get here) Yeap, it can be flushed. There's no ref coming out of cgroup to the

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-12-02 Thread Serge E. Hallyn
On Wed, Dec 02, 2015 at 11:53:12AM -0500, Tejun Heo wrote: > Hello, Serge. > > On Tue, Dec 01, 2015 at 03:58:53PM -0600, Serge E. Hallyn wrote: > > I mispoke before though - it's not the hierarchy's root dentry, > > but rather a dentry for a descendent cgroup which will become the > > root dentry

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-12-02 Thread Tejun Heo
Hello, Serge. On Tue, Dec 01, 2015 at 03:58:53PM -0600, Serge E. Hallyn wrote: > I mispoke before though - it's not the hierarchy's root dentry, > but rather a dentry for a descendent cgroup which will become the > root dentry for the new superblock. We do know that there must be > a css_set with

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-12-01 Thread Serge E. Hallyn
On Tue, Dec 01, 2015 at 11:46:49AM -0500, Tejun Heo wrote: > Hey, Serge. > > On Mon, Nov 30, 2015 at 10:07:04PM -0600, Serge E. Hallyn wrote: > > So actually the way the code is now, the first mount cannot > > be done from a non-init user namespace; and kernfs_obtain_root() > > is only called from

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-12-01 Thread Tejun Heo
Hey, Serge. On Mon, Nov 30, 2015 at 10:07:04PM -0600, Serge E. Hallyn wrote: > So actually the way the code is now, the first mount cannot > be done from a non-init user namespace; and kernfs_obtain_root() > is only called from non-init user namespace. So can we assume > that the root dentry will

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-11-30 Thread Serge E. Hallyn
On Mon, Nov 30, 2015 at 10:09:38AM -0500, Tejun Heo wrote: > Hello, Serge. > > On Thu, Nov 26, 2015 at 11:17:45PM -0600, Serge E. Hallyn wrote: > > > Wouldn't it be simpler to walk dentry from kernfs root than > > > duplicating dentry instantiation? > > > > Sorry I don't think I'm following. Are

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-11-30 Thread Tejun Heo
Hello, Serge. On Thu, Nov 26, 2015 at 11:17:45PM -0600, Serge E. Hallyn wrote: > > Wouldn't it be simpler to walk dentry from kernfs root than > > duplicating dentry instantiation? > > Sorry I don't think I'm following. Are you suggesting walking the > kn->parent chain backward and doing d_looku

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-11-26 Thread Serge E. Hallyn
On Tue, Nov 24, 2015 at 12:16:10PM -0500, Tejun Heo wrote: > Hello, > > On Mon, Nov 16, 2015 at 01:51:44PM -0600, se...@hallyn.com wrote: > > +struct dentry *kernfs_obtain_root(struct super_block *sb, > > + struct kernfs_node *kn) > > +{ > > + struct dentry *dentry; >

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-11-25 Thread Tejun Heo
On Wed, Nov 25, 2015 at 07:55:53PM +, Serge Hallyn wrote: > Quoting Tejun Heo (t...@kernel.org): > > Hello, Serge. > > > > On Wed, Nov 25, 2015 at 12:01:56AM -0600, Serge E. Hallyn wrote: > > > that was my goal with > > > https://git.kernel.org/cgit/linux/kernel/git/sergeh/linux-security.git/

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-11-25 Thread Serge Hallyn
Quoting Tejun Heo (t...@kernel.org): > Hello, Serge. > > On Wed, Nov 25, 2015 at 12:01:56AM -0600, Serge E. Hallyn wrote: > > that was my goal with > > https://git.kernel.org/cgit/linux/kernel/git/sergeh/linux-security.git/commit/?h=cgroupns.v4&id=8eb75d2bb24df59e262f050dce567d2332adc5f3 > > (whi

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-11-25 Thread Tejun Heo
Hello, Serge. On Wed, Nov 25, 2015 at 12:01:56AM -0600, Serge E. Hallyn wrote: > that was my goal with > https://git.kernel.org/cgit/linux/kernel/git/sergeh/linux-security.git/commit/?h=cgroupns.v4&id=8eb75d2bb24df59e262f050dce567d2332adc5f3 > (which was sent inline earlier in this thread in resp

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-11-24 Thread Serge E. Hallyn
On Tue, Nov 24, 2015 at 12:16:10PM -0500, Tejun Heo wrote: ... > > + if (ns != &init_cgroup_ns) { > > + struct dentry *nsdentry; > > + struct cgroup *cgrp; > > + > > + cgrp = cset_cgroup_from_root(ns->root_cgrps, root); > > +

Re: [lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-11-24 Thread Tejun Heo
Hello, On Mon, Nov 16, 2015 at 01:51:44PM -0600, se...@hallyn.com wrote: > +struct dentry *kernfs_obtain_root(struct super_block *sb, > + struct kernfs_node *kn) > +{ > + struct dentry *dentry; > + struct inode *inode; > + > + BUG_ON(sb->s_op != &kernfs_so

[lxc-devel] [PATCH 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns

2015-11-16 Thread serge
From: Aditya Kali This patch enables cgroup mounting inside userns when a process as appropriate privileges. The cgroup filesystem mounted is rooted at the cgroupns-root. Thus, in a container-setup, only the hierarchy under the cgroupns-root is exposed inside the container. This allows container