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] [day] [month] [year] [list]
Message-ID: <20151203102657.44609f0b@gandalf.local.home>
Date:	Thu, 3 Dec 2015 10:26:57 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Xunlei Pang <xlpang@...hat.com>
Cc:	linux-kernel@...r.kernel.org,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH v2 1/3] sched/core: Clear the root_domain cpumasks in
 init_rootdomain()

On Thu,  3 Dec 2015 12:44:59 +0800
Xunlei Pang <xlpang@...hat.com> wrote:

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

I really hate the fact that alloc_cpumask_var() behaves differently
depending on weather or not CONFIG_CPUMASK_OFFSTACK is defined or not.
I wonder if the better solution is to pass the __GFP_ZERO into
allocating the cpu mask when CPUMASK_OFFSTACK is defined. This will
prevent other areas from having this same bug. Also, I doubt any
allocations of cpumasks is in performance critical sections.

Or at least see if the address passed in is already null, which tells
us that something already cleared it. Like in this case the
memset(rd, 0, sizeof(*rd)).

Have something like:

bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
{
	if ((long)*mask == 0)
		flags |= __GFP_ZERO;

Maybe I'll post a patch to do this.

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

Acked-by: Steven Rostedt <rostedt@...dmis.org>

-- Steve

> 
> Signed-off-by: Xunlei Pang <xlpang@...hat.com>
> ---
--
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