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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 12 Mar 2009 23:15:01 +0530
From:	Dhaval Giani <dhaval@...ux.vnet.ibm.com>
To:	Srivatsa Vaddagiri <vatsa@...ux.vnet.ibm.com>,
	lkml <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>, menage@...gle.com
Cc:	Balbir Singh <balbir@...ibm.com>
Subject: cpuset: Check if the cpus allowed is a subset of the cpuset's cpus
	for PF_THREAD_BOUND threads


When a kernel thread which has been bound to a CPU is moved to
a cpuset which is a superset of the CPU it is bound to, the
movement fails.

[root@...11 cgroups]# mkdir a
[root@...11 cgroups]# echo 3 > a/cpuset.cpus
[root@...11 cgroups]# echo 0 > a/cpuset.mems
[root@...11 cgroups]# echo 12 > a/tasks
[root@...11 cgroups]# echo 12 > tasks
-bash: echo: write error: Invalid argument
[root@...11 cgroups]# cat cpuset.cpus
0-7
[root@...11 cgroups]#

(pid 12 is the migration thread bound to CPU 3)

Change the check to see if the cpus allowed is a subset of the
cpus allowed for that cpuset.

Signed-off-by: Dhaval Giani <dhaval@...ux.vnet.ibm.com>
---
 kernel/cpuset.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1362,7 +1362,7 @@ static int cpuset_can_attach(struct cgro
 
 	if (tsk->flags & PF_THREAD_BOUND) {
 		mutex_lock(&callback_mutex);
-		if (!cpumask_equal(&tsk->cpus_allowed, cs->cpus_allowed))
+		if (!cpumask_subset(&tsk->cpus_allowed, cs->cpus_allowed))
 			ret = -EINVAL;
 		mutex_unlock(&callback_mutex);
 	}
-- 
regards,
Dhaval
--
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