CETS: Compiler Enforced Temporal Safety for C

Temporal memory safety errors, such as dangling pointer dereferences and double frees, are a prevalent source of software bugs in unmanaged languages such as C. Existing schemes that attempt to retrofit temporal safety for such languages have high runtime overheads and/or are incomplete, thereby lim...

Full description

Bibliographic Details
Main Authors: Nagarakatte, Santosh, Martin, Milo, Zhao, Jianzhou, Zdancewic, Stephan A
Format: Conference Object
Language:unknown
Published: 2010
Subjects:
Online Access:https://repository.upenn.edu/handle/20.500.14332/6772
https://hdl.handle.net/20.500.14332/6772
Description
Summary:Temporal memory safety errors, such as dangling pointer dereferences and double frees, are a prevalent source of software bugs in unmanaged languages such as C. Existing schemes that attempt to retrofit temporal safety for such languages have high runtime overheads and/or are incomplete, thereby limiting their effectiveness as debugging aids. This paper presents CETS, a compile-time transformation for detecting all violations of temporal safety in C programs. Inspired by existing approaches, CETS maintains a unique identifier with each object, associates this metadata with the pointers in a disjoint metadata space to retain memory layout compatibility, and checks that the object is still allocated on pointer dereferences. A formal proof shows that this is sufficient to provide temporal safety even in the presence of arbitrary casts if the program contains no spatial safety violations. Our CETS prototype employs both temporal check removal optimizations and traditional compiler optimizations to achieve a runtime overhead of just 48% on average. When combined with a spatial-checking system, the average overall overhead is 116% for complete memory safety. Nagarakatte, S., Zhao, J., Martin, M., & Zdancewic, S., CETS: Compiler Enforced Temporal Safety for C, ACM SIGPLAN International Symposium on Memory Management , June 2010, doi: http://doi.acm.org/10.1145/1806651.1806657 © 1994, 1995, 1998, 2002, 2009 by ACM, Inc. Permission to copy and distribute this document is hereby granted provided that this notice is retained on all copies, that copies are not altered, and that ACM is credited when the material is used to form other copyright policies.