PLAISEJun 20

CNnotator: LLM-Guided Memory Safety Annotation Synthesis

arXiv:2606.218228.2
Predicted impact top 41% in PL · last 90 daysOriginality Incremental advance
AI Analysis

For developers migrating legacy C code to memory-safe languages, this automates the tedious task of inferring memory usage patterns, reducing manual effort.

CNnotator uses LLMs to automatically generate CN memory safety annotations for C code, achieving 90% first-attempt success with OpenAI o3 and 97% overall, demonstrating practical AI-assisted annotation for real-world codebases.

Memory safety errors account for a large proportion of security bugs in systems written in C; modern languages such as Java and Rust prevent such bugs because they are memory-safe by design. To migrate systems to safer languages or identify memory errors, we must first determine how legacy code manipulates memory. This information is only represented implicitly in such code. In many cases, memory usage patterns are merely tedious for humans to figure out, rather than truly difficult. In this work, we ask if large language models (LLMs) can perform this task by having them synthesize annotations representing memory usage as specifications in CN, a hybrid testing/verification tool. Our tool, CNnotator, uses LLMs to automatically generate and test CN specifications. We find that current models are able to generate CN specifications for small-to-medium C programs, with the OpenAI o3 reasoning model achieving a 90% success rate on first attempts and 97% overall success, while the chat model GPT-4o correctly annotates 65% of first attempts. These results suggest AI-assisted annotation is becoming practical for real-world C codebases.

Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes