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: <1449117901-9561-1-git-send-email-xlpang@redhat.com>
Date:	Thu,  3 Dec 2015 12:44:59 +0800
From:	Xunlei Pang <xlpang@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Xunlei Pang <xlpang@...hat.com>
Subject: [PATCH v2 1/3] sched/core: Clear the root_domain cpumasks in init_rootdomain()

root_domain::rto_mask allocated through alloc_cpumask_var()
contains garbage data with CONFIG_CPUMASK_OFFSTACK set, this
may cause problems. For instance, When doing pull_rt_task(),
it may do useless iterations if rto_mask retains some extra
garbage bits. Worse still, this can violate the isolated domain
rule for clustered scheduling using cpuset, because the tasks
(with all the cpus allowed) which belongs to one root domain
can be pulled away into another root domain.

The patch cleans the garbage by passing alloc_cpumask_var()
with an extra __GFP_ZERO for root_domain::rto_mask allocation,
thereby addressing the issues.

Do the same thing for root_domain's other cpumask memembers:
dlo_mask, span, and online.

Signed-off-by: Xunlei Pang <xlpang@...hat.com>
---
v1->v2:
Use alloc_cpumask_var() with __GFP_ZERO instead of zalloc_cpumask_var()
to avoid duplicate clean for systems without CONFIG_CPUMASK_OFFSTACK set.

 kernel/sched/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5b420d2..c11e11e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5858,13 +5858,13 @@ static int init_rootdomain(struct root_domain *rd)
 {
 	memset(rd, 0, sizeof(*rd));
 
-	if (!alloc_cpumask_var(&rd->span, GFP_KERNEL))
+	if (!alloc_cpumask_var(&rd->span, GFP_KERNEL | __GFP_ZERO))
 		goto out;
-	if (!alloc_cpumask_var(&rd->online, GFP_KERNEL))
+	if (!alloc_cpumask_var(&rd->online, GFP_KERNEL | __GFP_ZERO))
 		goto free_span;
-	if (!alloc_cpumask_var(&rd->dlo_mask, GFP_KERNEL))
+	if (!alloc_cpumask_var(&rd->dlo_mask, GFP_KERNEL | __GFP_ZERO))
 		goto free_online;
-	if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL))
+	if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL | __GFP_ZERO))
 		goto free_dlo_mask;
 
 	init_dl_bw(&rd->dl_bw);
-- 
2.5.0

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