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: <20160617082337.GM30154@twins.programming.kicks-ass.net>
Date:	Fri, 17 Jun 2016 10:23:37 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Andrey Ryabinin <aryabinin@...tuozzo.com>
Cc:	Yuyang Du <yuyang.du@...el.com>,
	Chris Wilson <chris@...is-wilson.co.uk>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Mike Galbraith <efault@....de>,
	Thomas Gleixner <tglx@...utronix.de>, bsegall@...gle.com,
	morten.rasmussen@....com, pjt@...gle.com, steve.muckle@...aro.org,
	linux-kernel@...r.kernel.org, kernel@...p.com
Subject: Re: Divide-by-zero in post_init_entity_util_avg

On Fri, Jun 17, 2016 at 11:16:24AM +0300, Andrey Ryabinin wrote:
> > I suppose instead we'd want something like:
> > 
> > 	tmp = READ_ONCE(*ptr);
> > 	if (tmp > val)
> > 	  tmp -= val;
> > 	else
> > 	  tmp = 0;
> > 	WRITE_ONCE(*ptr, tmp);
> > 
> > In order to generate:
> > 
> >   xchg   %rax,0xa0(%r13)
> >   mov    0x78(%r13),%rcx
> >   sub    %rax,%rcx
> >   cmovae %r15,%rcx
> >   mov    %rcx,0x78(%r13)
> > 
> > however, GCC isn't smart enough and generates:
> > 
> >   xchg   %rax,0x98(%r13)
> >   mov    0x70(%r13),%rsi
> >   mov    %rsi,%rcx
> >   sub    %rax,%rcx
> >   cmp    %rsi,%rax
> >   cmovae %r15,%rcx
> >   mov    %rcx,0x70(%r13)
> > 
> > Doing a CMP with the _same_ values it does the SUB with, resulting in
> > exactly the same CC values.
> > 
> 
> FYI - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3507  (Reported:	2001-07-01)
> 

I found this one when I was googling yesterday:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30315

But yes, it seems this is a 'known' issue.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ