[Bug 1027977] Re: strstr() function produces wrong results under valgrind callgrind

Steve Langasek steve.langasek at canonical.com
Sat Jan 26 00:07:07 UTC 2013


Hello Moritz, or anyone else affected,

Accepted valgrind into precise-proposed. The package will build now and
be available at
http://launchpad.net/ubuntu/+source/valgrind/1:3.7.0-0ubuntu3.1 in a few
hours, and then in the -proposed repository.

Please help us by testing this new package.  See
https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to
enable and use -proposed.  Your feedback will aid us getting this update
out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug,
mentioning the version of the package you tested, and change the tag
from verification-needed to verification-done. If it does not fix the
bug for you, please add a comment stating that, and change the tag to
verification-failed.  In either case, details of your testing will help
us make a better decision.

Further information regarding the verification process can be found at
https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in
advance!

** Changed in: valgrind (Ubuntu Precise)
       Status: Triaged => Fix Committed

** Tags added: verification-needed

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to valgrind in Ubuntu.
https://bugs.launchpad.net/bugs/1027977

Title:
  strstr() function produces wrong results under valgrind callgrind

Status in Valgrind:
  Fix Released
Status in “valgrind” package in Ubuntu:
  Fix Released
Status in “valgrind” source package in Precise:
  Fix Committed
Status in “valgrind” source package in Quantal:
  Fix Released

Bug description:
  EDIT: adapted description according to SRU Bug Template

  [IMPACT]

   * impact on users:
  Profiling an application with callgrind produces false results: The application silently changes behavior because of false strstr() results in certain cases.

   * justification for backporting the fix to the stable release:
  - 12.04 is a LTS release. Lots of people installed it for that very reason and intend to stick with it until the next LTS release. Especially as this bug affects mainly software developers and in professional environments the upgrade cycles are longer.
  Those people will not benefit from a fix in the upcoming release.
  - The patch is very small and local.
  - There is no danger in backporting it (see Regression Potential below).
  - The fix is already in 12.10 and could be taken directly from there without any hassle.

   * The emulation of a certain SSE4-instruction in the valgrind package
  in 12.04 is flawed. This bug is fixed by a patch made by the upstream
  author.

  The debdiff of 1:3.7.0-0ubuntu4 can and should be backported without change to precise. The other fixed issue is also SRU material, see bug 1036283
  debdiff in comment 26

  [TESTCASE]

  When an application that uses the strstr() function from the C standard library is profiled with valgrind --tool=callgrind, the strstr() function produces false results (at least) under the following conditions:
  * the string s1 to search in and the string s2 to search for are exact duplicates, that is strcmp(s1,s2)==0. s1 and s2 don't need to be pointing to the same memory object.
  * the string length (excluding terminating zero) is a multiple of 16

  Expected result: strstr(s1,s2) returns s1, indicating a match at the first charactor of s1
  What happens: strstr(s1,s2) returns NULL, indicating no matching substring was found.

  See attached minimal testcase for an example. Reproduce under Ubuntu 12.04 with the following steps:
  $gcc strstrtest.c -o strstrtest
  $./ strstrtest    # <-- should report no errors
  $valgrind --tool=callgrind ./ strstrtest  # <-- should report errors for lengths multiple of 16

  - The Problem does not show up under valgrind-3.6.0.SVN-Debian from Ubuntu 10.04 Lucid Lynx
  - The Problem does not show up under tool=memcheck.

  [Regression Potential]

   * I don't see any danger of regressions. There is no change in behavior other than correcting false behavior in one place. No other applications depend on valgrind/callgrind, especially nothing that a normal user or server administrator ever uses.
  * I've been using the patched version for 2 months now without any problems.
  * If this should introduce any sort of regression, it will only affect valgrind/callgrind itself and no other parts of the system.

  ---
  Old description:

  $valgrind --version
  valgrind-3.7.0

  When an application that uses the strstr() function from the C standard library is profiled with valgrind --tool=callgrind, the strstr() function produces false results (at least) under the following conditions:
  * the string s1 to search in and the string s2 to search for are exact duplicates, that is strcmp(s1,s2)==0. s1 and s2 don't need to be pointing to the same memory object.
  * the string length (excluding terminating zero) is a multiple of 16

  Expected result: strstr(s1,s2) returns s1, indicating a match at the first charactor of s1
  What happens: strstr(s1,s2) returns NULL, indicating no matching substring was found.

  See attached minimal testcase for an example. Reproduce under Ubuntu 12.04 with the following steps:
  $gcc strstrtest.c -o strstrtest
  $./ strstrtest    # <-- should report no errors
  $valgrind --tool=callgrind ./ strstrtest  # <-- should report errors for lengths multiple of 16

  - The Problem does not show up under valgrind-3.6.0.SVN-Debian from Ubuntu 10.04 Lucid Lynx
  - The Problem does not show up under tool=memcheck.

  Some more info:
  OS: Ubuntu 12.04 Precise Pangolin
  $uname -a
  Linux mhassert 3.2.0-26-generic #41-Ubuntu SMP Thu Jun 14 17:49:24 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

To manage notifications about this bug go to:
https://bugs.launchpad.net/valgrind/+bug/1027977/+subscriptions




More information about the foundations-bugs mailing list