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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1540492943-17147-4-git-send-email-srikar@linux.vnet.ibm.com>
Date:   Fri, 26 Oct 2018 00:12:23 +0530
From:   Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To:     Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Rik van Riel <riel@...riel.com>,
        Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Wang <wang.yi59@....com.cn>, zhong.weidong@....com.cn,
        Yi Liu <liu.yi24@....com.cn>,
        Frederic Weisbecker <frederic@...nel.org>
Subject: [PATCH v3 3/3] sched/core: Error out if cpumask has a mix of isolcpus and housekeeping CPUs

Return EINVAL, if the user has passed a mix of isolcpus and housekeeping
CPUs in cpumask to sched_setaffinity(). This will ensure that users are
notified so that they can take corrective actions to ensure consistent
behaviour. This might cause a change in sched_setaffinity behaviour when
isolcpus is set.

Suggested-by: Mel Gorman <mgorman@...hsingularity.net>
Signed-off-by: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
---
 kernel/sched/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 37e62b8..3842471 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4798,9 +4798,12 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
 	 * housekeeping_cpumask
 	 */
 	if (!cpumask_subset(new_mask, hk_mask) &&
-			cpumask_intersects(new_mask, hk_mask))
+			cpumask_intersects(new_mask, hk_mask)) {
 		pr_warn("pid %d: Mix of isolcpus and non-isolcpus provided\n",
 			p->pid);
+		retval = -EINVAL;
+		goto out_free_new_mask;
+	}
 
 	/*
 	 * Since bandwidth control happens on root_domain basis,
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ