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-next>] [day] [month] [year] [list]
Message-Id: <1393510855-8771-1-git-send-email-sasha.levin@oracle.com>
Date:	Thu, 27 Feb 2014 09:20:55 -0500
From:	Sasha Levin <sasha.levin@...cle.com>
To:	lizefan@...wei.com
Cc:	linux-kernel@...r.kernel.org, Sasha Levin <sasha.levin@...cle.com>
Subject: [PATCH] cpuset: Add missing rcu read locks

We call task_cs() which ends up going into cgroup code without having rcu
read lock. Fix it by grabbing the lock before retrival of task_cs() and usage
of the result.

Signed-off-by: Sasha Levin <sasha.levin@...cle.com>
---
 kernel/cpuset.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index be9c1da..64bd8a4 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -2240,8 +2240,10 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask)
 
 	mutex_lock(&callback_mutex);
 	task_lock(tsk);
+	rcu_read_lock();
 	cpus_cs = effective_cpumask_cpuset(task_cs(tsk));
 	guarantee_online_cpus(cpus_cs, pmask);
+	rcu_read_unlock();
 	task_unlock(tsk);
 	mutex_unlock(&callback_mutex);
 }
@@ -2296,8 +2298,10 @@ nodemask_t cpuset_mems_allowed(struct task_struct *tsk)
 
 	mutex_lock(&callback_mutex);
 	task_lock(tsk);
+	rcu_read_lock();
 	mems_cs = effective_nodemask_cpuset(task_cs(tsk));
 	guarantee_online_mems(mems_cs, &mask);
+	rcu_read_unlock();
 	task_unlock(tsk);
 	mutex_unlock(&callback_mutex);
 
-- 
1.7.2.5

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