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]
Message-Id: <20240528005648.182376-5-yury.norov@gmail.com>
Date: Mon, 27 May 2024 17:56:46 -0700
From: Yury Norov <yury.norov@...il.com>
To: linux-kernel@...r.kernel.org,
	cgroups@...r.kernel.org,
	linux-mm@...ck.org,
	rcu@...r.kernel.org,
	linux-trace-kernel@...r.kernel.org
Cc: Yury Norov <yury.norov@...il.com>,
	"Paul E. McKenney" <paulmck@...nel.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Amit Daniel Kachhap <amit.kachhap@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Anna-Maria Behnsen <anna-maria@...utronix.de>,
	Christoph Lameter <cl@...ux.com>,
	Daniel Lezcano <daniel.lezcano@...aro.org>,
	Dennis Zhou <dennis@...nel.org>,
	Frederic Weisbecker <frederic@...nel.org>,
	Johannes Weiner <hannes@...xchg.org>,
	Juri Lelli <juri.lelli@...hat.com>,
	Kees Cook <keescook@...omium.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Rasmus Villemoes <linux@...musvillemoes.dk>,
	Tejun Heo <tj@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ulf Hansson <ulf.hansson@...aro.org>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Viresh Kumar <viresh.kumar@...aro.org>,
	Zefan Li <lizefan.x@...edance.com>
Subject: [PATCH 4/6] sched: drop sched.h dependency on cpumask

sched.h needs cpumask.h mostly for types declaration. Now that we have
cpumask_types.h, which is a significantly smaller header, we can rely on
it.

The only exception is UP stub for set_cpus_allowed_ptr(). The function
needs to test bit #0 in a @new_mask, which can be trivially opencoded.

Signed-off-by: Yury Norov <yury.norov@...il.com>
---
 include/linux/sched.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 98abb07de149..f2f907ef1389 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -13,7 +13,7 @@
 #include <asm/processor.h>
 #include <linux/thread_info.h>
 #include <linux/preempt.h>
-#include <linux/cpumask.h>
+#include <linux/cpumask_types.h>
 
 #include <linux/cache.h>
 #include <linux/irqflags_types.h>
@@ -1778,7 +1778,8 @@ static inline void do_set_cpus_allowed(struct task_struct *p, const struct cpuma
 }
 static inline int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
 {
-	if (!cpumask_test_cpu(0, new_mask))
+	/* Opencoded cpumask_test_cpu(0, new_mask) to avoid dependency on cpumask.h */
+	if ((*cpumask_bits(new_mask) & 1) == 0)
 		return -EINVAL;
 	return 0;
 }
-- 
2.40.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ