Fast as a shadow, expressive as a tree: Optimized memory monitoring for C - CEA - Commissariat à l’énergie atomique et aux énergies alternatives Access content directly
Journal Articles Science of Computer Programming Year : 2016

Fast as a shadow, expressive as a tree: Optimized memory monitoring for C


One classical approach to ensuring memory safety of C programs is based on storing block metadata in a tree-like datastructure. However it becomes relatively slow when the number of memory locations in the tree becomes high. Another solution, based on shadow memory, allows very fast constant-time access to metadata and led to development of several highly optimized tools for the detection of memory safety errors. However, this solution appears to be insufficient for evaluation of complex memory-related properties of an expressive specification language. In this work, we address memory monitoring in the context of runtime assertion checking of C programs annotated in E-ACSL, an expressive specification language offered by the FRAMA-C framework for the analysis of C code. We present an original combination of a tree-based and a shadow-memory-based techniques that reconciles the efficiency of shadow memory and the higher expressiveness of annotations that can be evaluated using a tree of metadata. Shadow memory with its instant access to stored metadata is used whenever small shadow metadata suffices to evaluate required annotations, while richer metadata stored in a compact prefix tree (Patricia trie) is used for evaluation of more complex memory annotations supported by E-ACSL. We also present a preliminary static analysis step that determines which variables should be monitored (and in which way) in order to be able to evaluate annotations present in the program. The combined monitoring technique and the pre-analysis step have been implemented in the runtime assertion checking tool for E-ACSL. Our initial experiments confirm that the proposed hybrid approach leads to a significant speedup with respect to an earlier implementation based on a Patricia trie alone without any loss of precision, while the proposed static analysis reduces the monitoring of irrelevant variables and further improves the performances of the instrumented code.

Dates and versions

cea-01845194 , version 1 (20-07-2018)



A. Jakobsson, N. Kosmatov, J. Signoles. Fast as a shadow, expressive as a tree: Optimized memory monitoring for C. Science of Computer Programming, 2016, 132, pp.226-246. ⟨10.1016/j.scico.2016.09.003⟩. ⟨cea-01845194⟩
20 View
0 Download



Gmail Mastodon Facebook X LinkedIn More