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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200709105906.GR597537@hirez.programming.kicks-ass.net>
Date:   Thu, 9 Jul 2020 12:59:06 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Ingo Molnar <mingo@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Kaitao Cheng <pilgrimtao@...il.com>,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] kernel/smp: Fix an off by one in csd_lock_wait_toolong()

On Thu, Jul 09, 2020 at 01:48:18PM +0300, Dan Carpenter wrote:
> The __per_cpu_offset[] array has "nr_cpu_ids" elements so change the >
> >= to prevent a read one element beyond the end of the array.
> 
> Fixes: 0504bc41a62c ("kernel/smp: Provide CSD lock timeout diagnostics")

I don't have a copy of that patch in my inbox, even though it says Cc:
me.

Paul, where do you expect that patch to go? The version I see from my
next tree needs a _lot_ of work.

> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> ---
>  kernel/smp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/smp.c b/kernel/smp.c
> index 78b602cae6c2..f49966713ac3 100644
> --- a/kernel/smp.c
> +++ b/kernel/smp.c
> @@ -171,7 +171,7 @@ static __always_inline bool csd_lock_wait_toolong(call_single_data_t *csd, u64 t
>  		*bug_id = atomic_inc_return(&csd_bug_count);
>  	cpu = csd_lock_wait_getcpu(csd);
>  	smp_mb(); // No stale cur_csd values!
> -	if (WARN_ONCE(cpu < 0 || cpu > nr_cpu_ids, "%s: cpu = %d\n", __func__, cpu))
> +	if (WARN_ONCE(cpu < 0 || cpu >= nr_cpu_ids, "%s: cpu = %d\n", __func__, cpu))
>  		cpu_cur_csd = READ_ONCE(per_cpu(cur_csd, 0));
>  	else
>  		cpu_cur_csd = READ_ONCE(per_cpu(cur_csd, cpu));
> -- 
> 2.27.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ