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]
Date:	Mon, 20 Nov 2006 00:17:31 +0300
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Alan Stern <stern@...land.harvard.edu>
Cc:	Jens Axboe <jens.axboe@...cle.com>,
	"Paul E. McKenney" <paulmck@...ibm.com>,
	Linus Torvalds <torvalds@...l.org>,
	Thomas Gleixner <tglx@...esys.com>,
	Ingo Molnar <mingo@...e.hu>,
	LKML <linux-kernel@...r.kernel.org>,
	john stultz <johnstul@...ibm.com>,
	David Miller <davem@...emloft.net>,
	Arjan van de Ven <arjan@...radead.org>,
	Andrew Morton <akpm@...l.org>, Andi Kleen <ak@...e.de>,
	manfred@...orfullife.com
Subject: Re: [patch] cpufreq: mark cpufreq_tsc() as core_initcall_sync

On 11/19, Alan Stern wrote:
> On Sun, 19 Nov 2006, Oleg Nesterov wrote:
> 
> > > What happens if synchronize_xxx manages to execute inbetween 
> > > xxx_read_lock's
> > > 
> > >  		idx = sp->completed & 0x1;
> > >  		atomic_inc(sp->ctr + idx);
> > > 
> > > statements?
> > 
> > Oops. I forgot about explicit mb() before sp->completed++ in synchronize_xxx().
> > 
> > So synchronize_xxx() should do
> > 
> > 	smp_mb();
> > 	idx = sp->completed++ & 0x1;
> > 
> > 	for (;;) { ... }
> > 
> > >               You see, there's no way around using synchronize_sched().
> > 
> > With this change I think we are safe.
> > 
> > If synchronize_xxx() increments ->completed in between, the caller of
> > xxx_read_lock() will see all memory ops (started before synchronize_xxx())
> > completed. It is ok that synchronize_xxx() returns immediately.
> 
> Yes, the reader will see a consistent picture, but it will have 
> incremented the wrong element of sp->ctr[].  What happens if another 
> synchronize_xxx() occurs while the reader is still running?

It will wait for xxx_read_unlock() on reader's side. And for this reason
this idx in fact is not exactly wrong :)

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