Checking Array Bound Violation Using Segmentation Hardware

  • Authors:
  • Lap-chung Lam

  • Affiliations:
  • State University of New York at Stony Brook

  • Venue:
  • DSN '05 Proceedings of the 2005 International Conference on Dependable Systems and Networks
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

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 avoidmany difficult bugs down the line. This paper proposes a novel approach called Cash to the array bound checking problem that exploits the segmentation feature in the virtual memory hardware of the X86 architecture. The Cash approach allocates a separate segment to each static array or dynamically allocated buffer, and generates the instructions for array references in such a way that the segment limit check in X86ýs virtual memory protection mechanism performs the necessary array bound checking for free. In those cases that hardware bound checking is not possible, it falls back to software bound checking. As a result, Cash does not need to pay per-reference software checking overhead in most cases. However, the Cash approach incurs a fixed set-up overhead for each use of an array, which may involve multiple array references. The existence of this overhead requires compiler writers to judiciously apply the proposed technique to minimize the performance cost of array bound checking. This paper presents the detailed design and implementation of the Cash compiler, and a comprehensive evaluation of various performance tradeoffs associated with the proposed array bound checking technique. For the set of complicated network applications we tested, including Apache, Sendmail, Bind, etc., the latency penalty of Cashýs bound checking mechanism is between 2.5% to 9.8% when compared with the baseline case that does not perform any bound checking.