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: <CA+55aFy2Erkros7qHpNBgbsGyP4azswTzWTFjSb2K4+KcFve2A@mail.gmail.com>
Date:	Fri, 27 Apr 2012 11:23:24 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Arnaldo Carvalho de Melo <acme@...radead.org>
Cc:	Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
	David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Hagen Paul Pfeifer <hagen@...u.net>,
	Mike Galbraith <efault@....de>,
	Namhyung Kim <namhyung@...il.com>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [GIT PULL 0/4] perf/annotate loop detection V2, fixes

On Fri, Apr 27, 2012 at 11:03 AM, Arnaldo Carvalho de Melo
<acme@...radead.org> wrote:
>
>> It seems to think that a backwards jump implies a loop. But that's not
>> at all true.
>
> Yeah, the jump has to be conditional.

Not at all.

Unconditional backwards jumps can easily be parts of loops. It's a
very valid loop that does basically

   for (;;) {
   }

with a few exit cases in the *middle* of the loop. Sometimes that is
the right way to write things, and sometimes gcc rewrites things that
way for other reasons.

And conditional backwards jumps are *not* automatically loops either. Doing a

   if (error)
      return error;

is perfectly normal - and that "return error" may well be a backwards
jump to the "return" code that was generated earlier.

Seriously: backwards jumps are not loops. Not unconditional ones, not
conditional ones.

The only way to find a loop is to follow the flow control and notice
that it closes a loop.

> I should have reworded the "loop detection" with "basic jump arrows" in
> the first place.

.. and that is fine. But then you need to do it for *forwards* jumps
too. There is no difference between backwards and forwards jumps
*unless* you are looking for loops, and if you are looking for loops
you need to actually find the cycle.

                            Linus
--
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