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]
Date:	Thu,  1 Sep 2011 14:36:33 +0100
From:	Ripduman Sohan <ripduman.sohan@...cam.ac.uk>
To:	tj@...nel.org
Cc:	linux-kernel@...r.kernel.org, peterz@...radead.org,
	Ripduman Sohan <ripduman.sohan@...cam.ac.uk>
Subject: [PATCH] workqueue: Restore cpus_allowed mask for sleeping workqueue rescue threads

Rescuer threads may be migrated (and are bound) to particular CPUs when
active.  However, the allowed_cpus mask is not restored when they return
to sleep rendering inconsistent the presented and actual set of CPUs the
process may potentially run on.  This patch fixes this oversight by
recording the allowed_cpus mask for rescuer threads when it enters the
rescuer_thread() main loop and restoring it every time the thread sleeps.

v2: Heeded Peter Zijlstra's comments and don't allocate cpumask_t on
    stack, manipulate task cpus_allowed struct directly instead

Signed-off-by: Ripduman Sohan <ripduman.sohan@...cam.ac.uk>
---
 kernel/workqueue.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 25fb1b0..29d2ddf 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2078,6 +2078,12 @@ repeat:
 		spin_unlock_irq(&gcwq->lock);
 	}
 
+        if (is_unbound)
+                cpumask_setall(&current->cpus_allowed);
+        else
+                for_each_cwq_cpu(cpu, wq)
+                        cpu_set(cpu, current->cpus_allowed);
+
 	schedule();
 	goto repeat;
 }
-- 
1.7.1

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