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: <20160609123557.GP30909@twins.programming.kicks-ass.net>
Date:	Thu, 9 Jun 2016 14:35:57 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Paolo Bonzini <pbonzini@...hat.com>
Cc:	Minfei Huang <mnghuan@...il.com>, bp@...e.de, luto@...nel.org,
	hpa@...or.com, mingo@...hat.com, tglx@...utronix.de,
	x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3 V2] pvclock: Get rid of __pvclock_read_cycles in
 function pvclock_read_flags

On Thu, Jun 09, 2016 at 02:26:59PM +0200, Paolo Bonzini wrote:
> 
> 
> On 09/06/2016 14:16, Peter Zijlstra wrote:
> > On Sat, May 28, 2016 at 08:27:43PM +0800, Minfei Huang wrote:
> >> +++ b/arch/x86/kernel/pvclock.c
> >> @@ -61,11 +61,14 @@ void pvclock_resume(void)
> >>  u8 pvclock_read_flags(struct pvclock_vcpu_time_info *src)
> >>  {
> >>  	unsigned version;
> >> -	cycle_t ret;
> >>  	u8 flags;
> >>  
> >>  	do {
> >> -		version = __pvclock_read_cycles(src, &ret, &flags);
> >> +		version = src->version;
> >> +		/* Make the latest version visible */
> >> +		smp_rmb();
> >> +
> >> +		flags = src->flags;
> > 
> > Using a seqcount to load a single byte is insane ;-)
> 
> Only if you know that the writer will not write that byte twice within a
> critical section...
> 
> Which I guess we do know in this case because the write side is just a
> memcpy, but it's still a bit safer when it's not specified by the
> pvclock API.  It's not a fast path anyway, it runs literally twice at
> startup.

Fair enough; just thought it was really silly code.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ