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]
Date:   Thu, 16 Feb 2023 06:07:51 +0000
From:   "Zhang, Qiang1" <qiang1.zhang@...el.com>
To:     Joel Fernandes <joel@...lfernandes.org>
CC:     "mingo@...hat.com" <mingo@...hat.com>,
        "peterz@...radead.org" <peterz@...radead.org>,
        "juri.lelli@...hat.com" <juri.lelli@...hat.com>,
        "paulmck@...nel.org" <paulmck@...nel.org>,
        "frederic@...nel.org" <frederic@...nel.org>,
        "rcu@...r.kernel.org" <rcu@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2] sched/isolation: Fix illegal CPU value by
 housekeeping_any_cpu() return

>
> For kernels built with CONFIG_NO_HZ_FULL=y, running the following tests:
>
[...]
> This commit therefore add checks for cpumask_any_and() return values
> in housekeeping_any_cpu(), if cpumask_any_and() returns an illegal CPU
> value, the housekeeping_any_cpu() will return current CPU number.
>
> Signed-off-by: Zqiang <qiang1.zhang@...el.com>
> ---
>  kernel/sched/isolation.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
> index 373d42c707bc..534397ab7a36 100644
> --- a/kernel/sched/isolation.c
> +++ b/kernel/sched/isolation.c
> @@ -46,7 +46,11 @@ int housekeeping_any_cpu(enum hk_type type)
>                         if (cpu < nr_cpu_ids)
>                                 return cpu;
>
> -                       return cpumask_any_and(housekeeping.cpumasks[type], cpu_online_mask);
> +                       cpu = cpumask_any_and(housekeeping.cpumasks[type], cpu_online_mask);
> +                       if (cpu >= nr_cpu_ids)
> +                               return smp_processor_id();
> +                       else
> +                               return cpu;
>
>Nit: no need of "else", simply:
>
>return (cpu >= nr_cpuids ? smp_processor_id() : cpu);

Thanks Joel, I have done the same modification in v3 version,  and this change is
also related to a 08ae95f4fd3b, after revert it, this calltrace will disappear.

Thanks
Zqiang


>
>or
>
>if (cpu >= nr_cpu_ids)
>   return smp_processor_id();
>return cpu;
>
>Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ