lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 30 Sep 2011 13:36:24 +0200
From:	Witold Krecicki <wpk@...m.net>
To:	Paul Menage <paul@...lmenage.org>, Li Zefan <lizf@...fujitsu.com>,
	containers@...ts.linux-foundation.org
Cc:	linux-kernel@...r.kernel.org, Witold Krecicki <wpk@...m.net>
Subject: [PATCH 5/6] cgroup: make cgroup filesystem mounts performed by task inside isolation root see its isolation root as top cgroup

This patch makes all mounts of cgroup filesystems performed by task
contained in isolation root see its isolation root as top cgroup.

Signed-off-by: Witold Krecicki <wpk@...m.net>
---
 kernel/cgroup.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index c3fee33..db66a82 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1504,6 +1504,7 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
 	int ret = 0;
 	struct super_block *sb;
 	struct cgroupfs_root *new_root;
+	struct dentry *dret;
 
 	/* First find the desired set of subsystems */
 	mutex_lock(&cgroup_mutex);
@@ -1624,7 +1625,9 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
 		revert_creds(cred);
 		mutex_unlock(&cgroup_mutex);
 		mutex_unlock(&inode->i_mutex);
+		dret = sb->s_root;
 	} else {
+		struct cgroup *isol_root;
 		/*
 		 * We re-used an existing hierarchy - the new root (if
 		 * any) is not needed
@@ -1632,11 +1635,20 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
 		cgroup_drop_root(opts.new_root);
 		/* no subsys rebinding, so refcounts don't change */
 		drop_parsed_module_refcounts(opts.subsys_bits);
+		/* If root isolation is enabled give partial root */
+		cgroup_lock();
+		isol_root = cgroup_get_isolation_root(
+				task_cgroup_from_root(current, root));
+		if (isol_root)
+			dret = isol_root->dentry;
+		else
+			dret = sb->s_root;
+		cgroup_unlock();
 	}
 
 	kfree(opts.release_agent);
 	kfree(opts.name);
-	return dget(sb->s_root);
+	return dget(dret);
 
  drop_new_super:
 	deactivate_locked_super(sb);
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ