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>] [day] [month] [year] [list]
Message-ID: <47DA811A.8040704@openvz.org>
Date:	Fri, 14 Mar 2008 16:43:54 +0300
From:	Pavel Emelyanov <xemul@...nvz.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
CC:	Balbir Singh <balbir@...ux.vnet.ibm.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH] Fix check for thread being a group leader in memcgroup

The check t->pid == t->pid is not the blessed way to check
whether a task is a group leader.

This is not about the code beautifulness only, but about 
pid namespaces fixes - both the tgid and the pid fields on 
the task_struct are (slowly :( ) becoming deprecated.

Besides, the thread_group_leader() macro makes only one
dereference :)

Signed-off-by: Pavel Emelyanov <xemul@...nvz.org>

---

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index eb681a6..bc4cac6 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1065,7 +1065,7 @@ static void mem_cgroup_move_task(struct cgroup_subsys *ss,
 	 * Only thread group leaders are allowed to migrate, the mm_struct is
 	 * in effect owned by the leader
 	 */
-	if (p->tgid != p->pid)
+	if (!thread_group_leader(p))
 		goto out;
 
 	css_get(&mem->css);

--
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