Baggy Bounds Checking: An Efficient and Backwards-Compatible Defense Against Out-of-Bounds Errors

18th USENIX Security Symposium (USENIX Security '09) |

Published by USENIX

Attacks that exploit out-of-bounds errors in C and C++ programs are still prevalent despite many years of research on bounds checking. Previous backwards compatible bounds checking techniques, which can be applied to unmodified C and C++ programs, maintain a data structure with the bounds for each allocated object and perform lookups in this data structure to check if pointers remain within bounds. This data structure can grow large and the lookups are expensive. In this paper we present a backwards compatible bounds checking technique that substantially reduces performance overhead. The key insight is to constrain the sizes of allocated memory regions and their alignment to enable efficient bounds lookups and hence efficient bounds checks at runtime. Our technique has low overhead in practice—only 8% throughput decrease for Apache – and is more than two times faster than the fastest previous technique and about five times faster – using less memory—than recording object bounds using a splay tree.