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: <alpine.DEB.2.20.1708312130260.2346@nanos>
Date:   Thu, 31 Aug 2017 21:32:30 +0200 (CEST)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Sebastian Andrzej Siewior <bigeasy@...utronix.de>
cc:     Mike Galbraith <efault@....de>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-rt-users <linux-rt-users@...r.kernel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Peter Zijlstra <peterz@...radead.org>
Subject: Re: [patch-rt] drivers/zram: fix zcomp_stream_get() smp_processor_id()
 use in preemptible code

On Thu, 31 Aug 2017, Sebastian Andrzej Siewior wrote:

> On 2017-08-31 21:11:08 [+0200], Thomas Gleixner wrote:
> > On Wed, 23 Aug 2017, Mike Galbraith wrote:
> > 
> > > 
> > > Use get_local_ptr() vs this_cpu_ptr().
> > > 
> > > Signed-off-by: Mike Galbraith <efault@....de>
> > > ---
> > >  drivers/block/zram/zcomp.c |    3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > --- a/drivers/block/zram/zcomp.c
> > > +++ b/drivers/block/zram/zcomp.c
> > > @@ -120,7 +120,7 @@ struct zcomp_strm *zcomp_stream_get(stru
> > >  {
> > >  	struct zcomp_strm *zstrm;
> > >  
> > > -	zstrm = *this_cpu_ptr(comp->stream);
> > > +	zstrm = *get_local_ptr(comp->stream);
> > 
> > This looks wrong. On mainline the calling code must have preemption disable
> > somehow, otherwise this_cpu_ptr() would not work.
> 
> This was introduced by Mike in a previous patch. The zstrm is only
> accessed while the spinlock is held.
> 
> > Looking at the call site it is;
> > 
> > 	zram_slot_lock()
> > 	  bit_spin_lock()
> > 
> > which is of course evading lockdep and everything else debugging wise.
> > 
> > Sebastian, do we have migration protection in bitlocked regions? And we
> > shpuld look into converting that into a spinlock on rt.
> 
> zram_lock_table() is bit_spin_lock() on !RT and spin_lock(&table->lock);
> on RT. So this is done.
> !RT has this running in a kmap_atomic() section so they have no
> preemption there.
> zcomp_stream_get() returns a per-CPU object which is protected with a
> spinlock and only accessed locked.

So when we are inside a spinlocked section, why is this_cpu_ptr() not
working? That does not make sense.

Thanks,

	tglx


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ