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: <20070721200627.GA107@tv-sign.ru>
Date:	Sun, 22 Jul 2007 00:06:27 +0400
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fix theoretical ccids_{read,write}_lock() race

On 07/21, Andrew Morton wrote:
>
> On Sat, 21 Jul 2007 23:11:04 +0400 Oleg Nesterov <oleg@...sign.ru> wrote:
> 
> > On 07/21, Andrew Morton wrote:
> > >
> > > On Sat, 21 Jul 2007 19:02:06 +0400 Oleg Nesterov <oleg@...sign.ru> wrote:
> > > 
> > > > Make sure that spin_unlock_wait() is properly ordered wrt atomic_inc().
> > > > 
> > > > Signed-off-by: Oleg Nesterov <oleg@...sign.ru>
> > > > 
> > > > --- t/net/dccp/ccid.c~ccid	2006-12-18 18:17:31.000000000 +0300
> > > > +++ t/net/dccp/ccid.c	2007-07-21 18:29:21.000000000 +0400
> > > > @@ -40,6 +40,7 @@ static inline void ccids_write_unlock(vo
> > > >  static inline void ccids_read_lock(void)
> > > >  {
> > > >  	atomic_inc(&ccids_lockct);
> > > > +	smp_mb__after_atomic_inc();
> > > >  	spin_unlock_wait(&ccids_lock);
> > > >  }
> > > >  
> > > 
> > > Why not just use standard rwlocks in there?
> > > 
> > > (This is probably an FAQ, but it should be).
> > 
> > Perhaps because read_lock() doesn't allow to sleep?
> > 
> 
> down_read() does.
> 
> afaict the code doesn't sleep while holding that lock anwyay.

Ah yes, it doesn't call kmem_cache_alloc() under ccids_read_lock().

So, really, why not read_lock/write_lock ?

Oleg.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ