All of lore.kernel.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: William Kennington <wak@google.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: GCC strcmp optimizations causing valgrind uninitialized conditional jumps
Date: Tue, 3 Jul 2018 14:18:33 -0500	[thread overview]
Message-ID: <20180703191833.GG16221@gate.crashing.org> (raw)
In-Reply-To: <CAPnigK=HP_F6a3EuM-G8XHH1G_SyLCscT72=yVwtFxDmBZ6WOQ@mail.gmail.com>

On Tue, Jul 03, 2018 at 11:59:14AM -0700, William Kennington wrote:
> Is there a bug tracking the issue?

https://bugs.kde.org/show_bug.cgi?id=386945

> Also, unless your malloc is
> guaranteed to be zeroing out the data or have a strcmp that is writing
> doubleworld aligned data to the string, the strcmp implementation is
> branching based on data existing after the null terminating character
> that may be uninitialized. Both sides of the branch do the right thing
> though, and locate the null terminator, throwing away the calculations
> done on the uninitialized data.

Yes, there is one branch that depends in part on irrelevant data, but
that is handled immediately afterwards.

> -fno-builtin-strcmp or -mstring-compare-inline-limit=0 do work fine
> but we don't control the binaries we are linking against in all cases
> and are seeing the issue pop up there.

Yeah, nasty.  I don't know what to do then (other than fix valgrind, which
isn't so easy either though!)


Segher

      reply	other threads:[~2018-07-03 19:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-03 18:26 GCC strcmp optimizations causing valgrind uninitialized conditional jumps William Kennington
2018-07-03 18:46 ` Segher Boessenkool
2018-07-03 18:59   ` William Kennington
2018-07-03 19:18     ` Segher Boessenkool [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180703191833.GG16221@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=wak@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.