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: <20070412062717.GA13047@kroah.com>
Date:	Wed, 11 Apr 2007 23:27:17 -0700
From:	Greg KH <greg@...ah.com>
To:	Eric Dumazet <dada1@...mosbay.com>
Cc:	Oliver Neukum <oneukum@...e.de>, Greg KH <gregkh@...e.de>,
	linux-kernel@...r.kernel.org
Subject: Re: CPU ordering with respect to krefs

On Mon, Apr 02, 2007 at 04:33:54PM +0200, Eric Dumazet wrote:
> On Mon, 2 Apr 2007 14:47:59 +0200
> Oliver Neukum <oneukum@...e.de> wrote:
> 
> > Hi,
> > 
> > some atomic operations are only atomic, not ordered. Thus a CPU is allowed
> > to reorder memory references to an object to before the reference is
> > obtained. This fixes it.
> > 
> > 	Regards
> > 		Oliver
> > Signed-off-by: Oliver Neukum <oneukum@...e.de>
> > ------
> > 
> > --- a/lib/kref.c	2007-04-02 14:40:40.000000000 +0200
> > +++ b/lib/kref.c	2007-04-02 14:40:50.000000000 +0200
> > @@ -21,6 +21,7 @@
> >  void kref_init(struct kref *kref)
> >  {
> >  	atomic_set(&kref->refcount,1);
> > +	smp_mb();
> >  }
> 
> I dont understand why smp_mb() is needed here, and not in
> spinlock_init() for example.

I think, after reading the Documentation/memory-barriers.txt and
Documentation/atomic_ops.txt documentation, that spin_lock_init() also
needs this kind of memory barrier.

>From what I can tell (Oliver, please correct me if I'm wrong, you know
this much better than I do), the issue is that atomic init has no memory
barrier, and you need to handle that.

thanks,

greg k-h
-
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