Affiliation:
1. University of California, Berkeley
Abstract
In this paper we propose a scheme that combines type inference and run-time checking to make existing C programs type safe. We describe the CCured type system, which extends that of C by separating pointer types according to their usage. This type system allows both pointers whose usage can be verified statically to be type safe, and pointers whose safety must be checked at run time. We prove a type soundness result and then we present a surprisingly simple type inference algorithm that is able to infer the appropriate pointer kinds for existing C programs.Our experience with the CCured system shows that the inference is very effective for many C programs, as it is able to infer that most or all of the pointers are statically verifiable to be type safe. The remaining pointers are instrumented with efficient run-time checks to ensure that they are used safely. The resulting performance loss due to run-time checks is 0-150%, which is several times better than comparable approaches that use only dynamic checking. Using CCured we have discovered programming bugs in established C programs such as several SPECINT95 benchmarks.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Reference29 articles.
1. Dynamic typing in a statically typed language
2. Efficient detection of all pointer and array access errors
3. Garbage collection in an uncooperative environment
4. Computing with coercions
5. L. Cardelli J. Donahue L. Glassman M. Jordan B. Kalsow and G. Nelson. Modula3 report 1989. L. Cardelli J. Donahue L. Glassman M. Jordan B. Kalsow and G. Nelson. Modula3 report 1989.
Cited by
148 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Memory Tagging using Cryptographic Integrity on Commodity x86 CPUs;2024 IEEE 9th European Symposium on Security and Privacy (EuroS&P);2024-07-08
2. Foundations for a Rust-Like Borrow Checker for C;Proceedings of the 25th ACM SIGPLAN/SIGBED International Conference on Languages, Compilers, and Tools for Embedded Systems;2024-06-20
3. Formal Mechanised Semantics of CHERI C: Capabilities, Undefined Behaviour, and Provenance;Proceedings of the 29th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 1;2024-04-17
4. GWP-ASan: Sampling-Based Detection of Memory-Safety Bugs in Production;Proceedings of the 46th International Conference on Software Engineering: Software Engineering in Practice;2024-04-14
5. A Smart Status Based Monitoring Algorithm for the Dynamic Analysis of Memory Safety;ACM Transactions on Software Engineering and Methodology;2023-12-11