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: <aa294db3-c3c6-e009-16d0-fc1fc9dd6854@redhat.com>
Date:   Tue, 29 Jan 2019 11:16:44 -0500
From:   Joe Lawrence <joe.lawrence@...hat.com>
To:     Masayoshi Mizuma <msys.mizuma@...il.com>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        linux-kernel@...r.kernel.org
Cc:     Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>
Subject: Re: [PATCH] sched/debug: initialize sd_sysctl_cpus if
 !CONFIG_CPUMASK_OFFSTACK

On 01/29/2019 10:12 AM, Masayoshi Mizuma wrote:
> From: Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>
> 
> register_sched_domain_sysctl() copies the cpu_possible_mask into
> sd_sysctl_cpus, but only if sd_sysctl_cpus hasn't already been
> allocated (ie, CONFIG_CPUMASK_OFFSTACK is set).  However, when
> CONFIG_CPUMASK_OFFSTACK is not set, sd_sysctl_cpus is left uninitialized
> (all zeroes) and the kernel may fail to initialize sched_domain sysctl
> entries for all possible cpus.
> 
> This is visible to the user if the kernel is booted with maxcpus=n, or
> if ACPI tables have been modified to leave cpus offline, and then
> checking for missing /proc/sys/kernel/sched_domain/cpu* entries.
> 
> Fix this by separating the allocataion and initialization, and adding

nit: s/allocataion/allocation (perhaps maintainer can fixup?)

> a flag to initialize the possible cpu entries while system booting only.
> 
> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>
> Reviewed-by: Masayoshi Mizuma <m.mizuma@...fujitsu.com>
> Tested-by: Syuuichirou Ishii <ishii.shuuichir@...fujitsu.com>
> Tested-by: Tarumizu, Kohei <tarumizu.kohei@...fujitsu.com>
> ---
>   kernel/sched/debug.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index de3de997e245..9c6637f3e21d 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -310,6 +310,7 @@ static struct ctl_table *sd_alloc_ctl_cpu_table(int cpu)
>   
>   static cpumask_var_t		sd_sysctl_cpus;
>   static struct ctl_table_header	*sd_sysctl_header;
> +static int register_sched_domain_sysctl_on_boot = 1;
>   
>   void register_sched_domain_sysctl(void)
>   {
> @@ -344,9 +345,12 @@ void register_sched_domain_sysctl(void)
>   	if (!cpumask_available(sd_sysctl_cpus)) {
>   		if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL))
>   			return;
> +	}
>   
> +	if (register_sched_domain_sysctl_on_boot) {
>   		/* init to possible to not have holes in @cpu_entries */
>   		cpumask_copy(sd_sysctl_cpus, cpu_possible_mask);
> +		register_sched_domain_sysctl_on_boot = 0;
>   	}
>   
>   	for_each_cpu(i, sd_sysctl_cpus) {
> 

Thanks for posting ... looks good on aarch64 where the issue mentioned 
in the commit message was reported.

Acked-by: Joe Lawrence <joe.lawrence@...hat.com>

-- Joe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ