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>] [day] [month] [year] [list]
Date:	Sun, 23 Mar 2008 20:51:37 +0300
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Pavel Emelyanov <xemul@...nvz.org>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] pids: sys_getpgid: use rcu_read_lock() instead of tasklist_lock

Convert sys_getpgid() to use rcu_read_lock() instead of tasklist_lock, make
sure we also check the result of task_pgrp_vnr().

Signed-off-by: Oleg Nesterov <oleg@...sign.ru>

--- 25/kernel/sys.c~2_GETPGID	2008-03-23 19:25:36.000000000 +0300
+++ 25/kernel/sys.c	2008-03-23 20:39:03.000000000 +0300
@@ -988,19 +988,19 @@ asmlinkage long sys_getpgid(pid_t pid)
 	if (!pid)
 		return task_pgrp_vnr(current);
 	else {
-		int retval;
+		int retval = 0;
 		struct task_struct *p;
 
-		read_lock(&tasklist_lock);
+		rcu_read_lock();
 		p = find_task_by_vpid(pid);
-		retval = -ESRCH;
 		if (p) {
 			retval = security_task_getpgid(p);
 			if (!retval)
 				retval = task_pgrp_vnr(p);
 		}
-		read_unlock(&tasklist_lock);
-		return retval;
+		rcu_read_unlock();
+
+		return retval ?: -ESRCH;
 	}
 }
 

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