skip to main content
10.5555/1247360.1247362guideproceedingsArticle/Chapter ViewAbstractPublication PagesConference Proceedingsacm-pubtype
Article

Using Valgrind to detect undefined value errors with bit-precision

Published: 10 April 2005 Publication History

Abstract

We present Memcheck, a tool that has been implemented with the dynamic binary instrumentation framework Valgrind. Memcheck detects a wide range of memory errors in programs as they run. This paper focuses on one kind of error that Memcheck detects: undefined value errors. Such errors are common, and often cause bugs that are hard to find in programs written in languages such as C, C++ and Fortran. Memcheck's definedness checking improves on that of previous tools by being accurate to the level of individual bits. This accuracy gives Memcheck a low false positive and false negative rate.
The definedness checking involves shadowing every bit of data in registers and memory with a second bit that indicates if the bit has a defined value. Every value-creating operation is instrumented with a shadow operation that propagates shadow bits appropriately. Memcheck uses these shadow bits to detect uses of undefined values that could adversely affect a program's behaviour.
Under Memcheck, programs typically run 20-30 times slower than normal. This is fast enough to use with large programs. Memcheck finds many errors in real programs, and has been used during the past two years by thousands of programmers on a wide range of systems, including OpenOffice, Mozilla, Opera, KDE, GNOME, MySQL, Perl, Samba, The GIMP, and Unreal Tournament.

References

[1]
{1} Michael D. Ernst. Static and dynamic analysis: synergy and duality. In Proceedings of WODA 2003, pages 6-9, Portland, Oregon, May 2003.
[2]
{2} Eric Estievenart. Valgui, a GPL front-end for Valgrind. http://valgui.sf.net/.
[3]
{3} Reed Hastings and Bob Joyce. Purify: Fast detection of memory leaks and access errors. In Proceedings of the Winter USENIX Conference, pages 125-136, San Francisco, California, USA, January 1992.
[4]
{4} J. C. Huang. Detection of data flow anomaly through program instrumentation. IEEE Transactions on Software Engineering, 5(3):226-236, May 1979.
[5]
{5} Willett Kempton and Brian A. Wichmann. Run-time detection of undefined variables considered essential. Software--Practice and Experience, 20(4):391-402, April 1990.
[6]
{6} Paul Mackerras. Re: Valgrind for PowerPC. Message to the valgrind-developers mailing list, March 2004.
[7]
{7} Jonas Maebe and Koen De Bosschere. Instrumenting self-modifying code. In Proceedings of AADE- BUG2003, Ghent, Belgium, September 2003.
[8]
{8} Dorit Naishlos. Autovectorisation in GCC. In Proceedings of the 2004 GCC Developers' Summit, Ottawa, Canada, June 2004.
[9]
{9} Nicholas Nethercote. Dynamic Binary Analysis and Instrumentation. PhD thesis, Computer Laboratory, University of Cambridge, United Kingdom, November 2004.
[10]
{10} Nicholas Nethercote and Julian Seward. Valgrind: A program supervision framework. In Proceedings of RV'03, Boulder, Colorado, USA, July 2003.
[11]
{11} Openoffice.org issue 20184, 2003. http://www.openoffice.org/ issues/show_bug.cgi?id=20184.
[12]
{12} Parasoft. Automatic C/C++ application testing with Parasoft Insure++. White paper.
[13]
{13} Jens-Heiner Rechtien. Validating and debugging openoffice.org with valgrind, 2003. http://tools.openoffice.org/ debugging/usingvalgrind.sxw.
[14]
{14} Julian Seward, Nicholas Nethercote, Jeremy Fitzhardinge, et al. Valgrind. http://www.valgrind.org/.
[15]
{15} Amitabh Srivastava and Alan Eustace. ATOM: A system for building customized program analysis tools. In Proceedings of PLDI '94, pages 196-205, Orlando, Florida, USA, June 1994.
[16]
{16} Standard Performance Evaluation Corporation. SPEC CPU2000 benchmarks. http://www.spec.org/.
[17]
{17} Jeffrey Stedfast. Alleyoop. http://alleyoop.sf.net/.
[18]
{18} Third Degree User Manual, May 1994.
[19]
{19} Josef Weidendorfer. KCachegrind. http://kcachegrind.sf.net/.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Guide Proceedings
ATEC '05: Proceedings of the annual conference on USENIX Annual Technical Conference
April 2005
588 pages

Publisher

USENIX Association

United States

Publication History

Published: 10 April 2005

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 28 Dec 2024

Other Metrics

Citations

Cited By

View all

View Options

View options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media