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 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.
Keywords :
buffer storage; computer viruses; formal verification; program compilers; program diagnostics; storage allocation; virtual storage; Cash compiler; X86 architecture; array bound checking problem; array bound violation; associated buffer bound; hardware segmentation; memory reference; programming error detection; software bound checking; virtual memory protection; Application software; Buffer overflow; Computer bugs; Computer errors; Computer science; Costs; Data structures; Hardware; Programming profession; Protection;