Nothing Special   »   [go: up one dir, main page]

Skip to main content

Fast Bounds Checking Using Debug Register

  • Conference paper
High Performance Embedded Architectures and Compilers (HiPEAC 2008)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 4917))

Abstract

The ability to check memory references against their associated array/buffer bounds helps programmers to detect programming errors involving address overruns early on and thus avoid many difficult bugs down the line. This paper proposes a novel approach called Boud to the array bounds checking problem that exploits the debug register hardware in modern CPUs. Boud allocates a debug register to monitor accesses to an array or buffer within a loop so that accesses stepping outside the array’s or buffer’s bound will trigger a breakpoint exeption. Because the number of debug registers is typically small, in cases when hardware bounds checking is not possible, Boud falls back to software bounds checking. Although Boud can effectively eliminate per-array-reference software checking overhead in most cases, it still incurs a fixed set-up overhead for each use of an array within a loop. This paper presents the detailed design and implementation of the Boud compiler, and a comprehensive evaluation of various performance tradeoffs associated with the proposed array bounds checking technique. For the set of real-world network applications we tested, including Apache, Sendmail, Bind, etc., the latency penalty of Boud’s bounds checking mechanism is between 2.2% to 8.8%, respectively, when compared with the vanilla GCC compiler, which does not perform any bounds checking.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Perens, B.: Electric fence: a malloc() debugger for linux and unix. http://perens.com/FreeSoftware/

  2. Bentley, C., Watterson, S.A., Lowenthal, D.K.: A comparison of array bounds checking on superscalar and vliw architectures. In: The annual IEEE Workshop on Workload Characterization (submitted)

    Google Scholar 

  3. Lam, L.-C., Chiueh, T.-C.: Checking array bound violation using segmentation hardware. In: DSN 2005. Proceedings of 2005 International Conference on Dependable Systems and Networks (June 2005)

    Google Scholar 

  4. Cowan, C., et al.: Stackguard: Automatic adaptive detection and prevention of buffer-overflow attacks. In: Proc. 7th USENIX Security Conference, San Antonio, Texas, pp. 63–78 (January 1998)

    Google Scholar 

  5. GCC. Bounds-checking gcc, http://www.gnu.org/software/gcc/projects/bp/main.html

  6. Pearson, G.: Array bounds checking with turbo c. Dr. Dobb’s Journal of Software Tools 16(5) 72, 74, 78–79, 81–82, 104–107 (1991)

    Google Scholar 

  7. Patil, H., Fischer, C.N.: Efficient run-time monitoring using shadow processing. In: Proceedings of Automated and Algorithmic Debugging Workshop, pp. 119–132 (1995)

    Google Scholar 

  8. Xi, H., Pfenning, F.: Eliminating array bound checking through dependent types. In: SIGPLAN Conference on Programming Language Design and Implementation, pp. 249–257 (1998)

    Google Scholar 

  9. Xi, H., Xia, S.: Towards array bound check elimination in java virtual machine language. In: Proceedings of CASCON 1999, Mississauga, Ontario, pp. 110–125 (November 1999)

    Google Scholar 

  10. Intel. IA-32 Intel Architecture Software Developer’s Manual vol. 2 Instruction Set Reference, http://www.intel.com/design/Pentium4/manuals/

  11. Intel. Ia-32 intel architecture software developer’s manual. volume 3: System programming guide, http://developer.intel.com/design/pentium4/manuals/245472.htm

  12. Asuru, J.M.: Optimization of array subscript range checks. ACM letters on Programming Languages and Systems 1(2), 109–118 (1992)

    Article  Google Scholar 

  13. Jones, R.W.M., Kelly, P.H.J.: Backwards-compatible bounds checking for arrays and pointers in c programs. In: Proceedings of Automated and Algorithmic Debugging Workshop, pp. 13–26 (1997)

    Google Scholar 

  14. Kolte, P., Wolfe, M.: Elimination of redundant array subscript range checks. In: SIGPLAN Conference on Programming Language Design and Implementation, pp. 270–278 (1995)

    Google Scholar 

  15. Prasad, M., Chiueh, T.-C.: A binary rewriting approach to stack-based buffer overflow attacks. In: Proceedings of 2003 USENIX Conference (June 2003)

    Google Scholar 

  16. Qin, F., Lu, S., Zhou, Y.: Safemem: Exploiting ecc-memory for detecting memory leaks and memory corruption during production runs. In: HPCA 2005. Proceedings of the 11th International Symposium on High-Performance Computer Architecture (February 2005)

    Google Scholar 

  17. Gupta, R.: A fresh look at optimizing array bound checking. In: SIGPLAN Conference on Programming Language Design and Implementation, pp. 272–282 (1990)

    Google Scholar 

  18. Gupta, R.: Optimizing array bound checks using flow analysis. ACM Letters on Programming Languages and Systems 2(1-4), 135–150 (1993)

    Article  Google Scholar 

  19. Bodik, R., Gupta, R., Sarkar, V.: Abcd: eliminating array bounds checks on demand. In: SIGPLAN Conference on Programming Language Design and Implementation, pp. 321–333 (2000)

    Google Scholar 

  20. Chiueh, T.-C., Hsu, F.-H.: Rad: A compiler time solution to buffer overflow attacks. In: ICDCS. Proceedings of International Conference on Distributed Computing Systems, Phoenix, Arizona (April 2001)

    Google Scholar 

  21. Chiueh, T.-C., Venkitachalam, G., Pradhan, P.: Integrating segmentation and paging protection for safe, efficient and transparent software extensions. In: Proceedings of 17th ACM Symposium on Operating Systems Principles, Charleston, SC (December 1999)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Per Stenström Michel Dubois Manolis Katevenis Rajiv Gupta Theo Ungerer

Rights and permissions

Reprints and permissions

Copyright information

© 2008 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Chiueh, Tc. (2008). Fast Bounds Checking Using Debug Register. In: Stenström, P., Dubois, M., Katevenis, M., Gupta, R., Ungerer, T. (eds) High Performance Embedded Architectures and Compilers. HiPEAC 2008. Lecture Notes in Computer Science, vol 4917. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-77560-7_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-77560-7_8

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-77559-1

  • Online ISBN: 978-3-540-77560-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics