C to Checked C by 3C

Aravind Machiry, John Kastner, Matt McCutchen, Aaron Eline, Kyle Headley +1 more
3/25/2022
28 citations
cs.PLcs.CRcs.SE

Official code: checkedc/checkedc (3,264 stars, C, last commit 2024-10-07). 1 more implementation below.

Abstract

Owing to the continued use of C (and C++), spatial safety violations (e.g., buffer overflows) still constitute one of today's most dangerous and prevalent security vulnerabilities. To combat these violations, Checked C extends C with bounds-enforced checked pointer types.

Show full abstract

Checked C is essentially a gradually typed spatially safe C - checked pointers are backwards-binary compatible with legacy pointers, and the language allows them to be added piecemeal, rather than necessarily all at once, so that safety retrofitting can be incremental. This paper presents a semi-automated process for porting a legacy C program to Checked C. The process centers on 3C, a static analysis-based annotation tool. 3C employs two novel static analysis algorithms - typ3c and boun3c - to annotate legacy pointers as checked pointers, and to infer array bounds annotations for pointers that need them. 3C performs a root cause analysis to direct a human developer to code that should be refactored; once done, 3C can be re-run to infer further annotations (and updated root causes). Experiments on 11 programs totaling 319KLoC show 3C to be effective at inferring checked pointer types, and experience with previously and newly ported code finds 3C works well when combined with human-driven refactoring.

View on arXivView PDF

Code Implementations(2)

Code implementations of this paper
RepositoryTypeStarsLanguageLicenseLast commit
checkedc/checkedcOfficial3,264C–2024-10-07
checkedc/checkedc-forkOfficial27C–2024-09-30
checkedc/checkedcOfficial100%

Checked C is an extension to C that lets programmers write C code with bounds checking and improved type-safety. The goal is to let people easily make their existing C code type-safe and eliminate entire classes of errors.

3,264189C, TeXFeb 23, 20162 years agoNOASSERTION
cclangllvmmemory-safetyprogramming-language+2 more

This was a fork of Checked C used from 2021-2024. The changes have been merged into the original Checked C repo.

273C, TeXJan 14, 20222 years agoNOASSERTION
cc-programming-languagereliabilitysecuritysystems-programming

Similar Papers

Cite this paper

@article{machiry2022checked,
  title  = {C to Checked C by 3C},
  author = {Aravind Machiry and John Kastner and Matt McCutchen and Aaron Eline and Kyle Headley and Michael Hicks},
  year   = {2022},
  eprint = {2203.13445},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2203.13445}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2203.13445.svg)](https://codeofpaper.com/paper/2203.13445)

Discussion