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: <YffF3e+uUIDVO7hm@FVFF7649Q05P>
Date:   Mon, 31 Jan 2022 11:19:57 +0000
From:   Vincent Donnefort <vincent.donnefort@....com>
To:     Yury Norov <yury.norov@...il.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        Valentin Schneider <valentin.schneider@....com>,
        Ingo Molnar <mingo@...nel.org>,
        YueHaibing <yuehaibing@...wei.com>,
        Yuan ZhaoXiong <yuanzhaoxiong@...du.com>,
        Randy Dunlap <rdunlap@...radead.org>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        linux-ia64@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernel/cpu.c: fix init_cpu_online

Hi Yury,

On Sun, Jan 30, 2022 at 05:46:48PM -0800, Yury Norov wrote:
> cpu_online_mask has an associate counter of online cpus, which must be
> initialized in init_cpu_online().
> 
> Fixes: 0c09ab96fc82010 (cpu/hotplug: Cache number of online CPUs)

Aren't the increments/decrements from set_cpu_online() enough?

I guess we could argue that this isn't a private function and the
num_online_cpus should be updated here. But unless I missed something,
init_cpu_online() is only called in ia64 arch, in the !SMP case. Is
this the problem you're trying to tackle? If not, I'm not sure that warrants a
"Fixes:" tag

> Signed-off-by: Yury Norov <yury.norov@...il.com>
> ---
>  kernel/cpu.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 407a2568f35e..cd7605204d4d 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -2616,6 +2616,7 @@ void init_cpu_possible(const struct cpumask *src)
>  void init_cpu_online(const struct cpumask *src)
>  {
>  	cpumask_copy(&__cpu_online_mask, src);
> +	atomic_set(&__num_online_cpus, cpumask_weight(cpu_online_mask));
>  }
>  
>  void set_cpu_online(unsigned int cpu, bool online)
> -- 
> 2.30.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ