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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 8 Mar 2009 14:38:50 -0700 (PDT)
From:	David Rientjes <rientjes@...gle.com>
To:	Paul Menage <menage@...gle.com>
cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Christoph Lameter <cl@...ux-foundation.org>,
	Pekka Enberg <penberg@...helsinki.fi>,
	Matt Mackall <mpm@...enic.com>,
	Randy Dunlap <randy.dunlap@...cle.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [patch -mm] cpusets: add memory_slab_hardwall flag

On Sun, 8 Mar 2009, Paul Menage wrote:

> > +/**
> > + * current_cpuset_object_allowed - can a slab object be allocated on a node?
> > + * @node: the node for object allocation
> > + * @flags: allocation flags
> > + *
> > + * Return non-zero if object is allowed, zero otherwise.
> > + */
> > +int current_cpuset_object_allowed(int node, gfp_t flags)
> > +{
> > +       return !is_slab_hardwall(task_cs(current)) ||
> > +              cpuset_node_allowed_hardwall(node, flags);
> > +}
> > +
> 
> This should be in rcu_read_lock()/rcu_read_unlock() in order to safely
> dereference the result of task_cs(current)
> 

I've folded the following into the patch, thanks Paul.
---
 kernel/cpuset.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1205,8 +1205,12 @@ int current_cpuset_is_being_rebound(void)
  */
 int current_cpuset_object_allowed(int node, gfp_t flags)
 {
-	return !is_slab_hardwall(task_cs(current)) ||
-	       cpuset_node_allowed_hardwall(node, flags);
+	int is_hardwall;
+
+	rcu_read_lock();
+	is_hardwall = is_slab_hardwall(task_cs(current));
+	rcu_read_unlock();
+	return !is_hardwall || cpuset_node_allowed_hardwall(node, flags);
 }
 
 static int update_relax_domain_level(struct cpuset *cs, s64 val)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ