Преглед на файлове

userns: Convert cgroup permission checks to use uid_eq

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Eric W. Biederman преди 13 години
родител
ревизия
14a590c3f9
променени са 2 файла, в които са добавени 3 реда и са изтрити 4 реда
  1. 0 1
      init/Kconfig
  2. 3 3
      kernel/cgroup.c

+ 0 - 1
init/Kconfig

@@ -865,7 +865,6 @@ config UIDGID_CONVERTED
 
 	# List of kernel pieces that need user namespace work
 	# Features
-	depends on CGROUPS = n
 	depends on MIGRATION = n
 	depends on NUMA = n
 	depends on SYSVIPC = n

+ 3 - 3
kernel/cgroup.c

@@ -2160,9 +2160,9 @@ retry_find_task:
 		 * only need to check permissions on one of them.
 		 */
 		tcred = __task_cred(tsk);
-		if (cred->euid &&
-		    cred->euid != tcred->uid &&
-		    cred->euid != tcred->suid) {
+		if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) &&
+		    !uid_eq(cred->euid, tcred->uid) &&
+		    !uid_eq(cred->euid, tcred->suid)) {
 			rcu_read_unlock();
 			ret = -EACCES;
 			goto out_unlock_cgroup;