Project-Level C-to-Rust Translation via Pointer Knowledge Graphs
Translating C code into Rust is an effective way to ensure its memory safety. Rule-based translation produces Rust code that remains unsafe and fails to leverage Rust’s safety features. LLM-based methods can generate more idiomatic and safer Rust as LLMs are trained on large amounts of human-written code. Although promising, existing LLM-based methods still struggle with project-level C-to-Rust translation. They typically partition a C project into smaller units (e.g., functions) based on the call graph and translate them bottom-up to resolve dependencies. However, this bottom-up, unit-by-unit paradigm often fails to handle pointer translation due to the lack of a global perspective on pointer usage. To address this, we propose a novel C-Rust Pointer Knowledge Graph (KG) that enriches a code-dependency graph with two types of pointer semantics: (i) pointer-usage information, recording global behaviors such as points-to flows and lower-level struct usage by higher-level units; and (ii) Rust-oriented annotations, encoding ownership, mutability, nullability, and lifetimes. Based on the C-Rust Pointer KG and its synergy with LLMs, we further propose PtrTrans, a project-level C-to-Rust translation technique. In PtrTrans, the C-Rust Pointer KG provides LLMs with comprehensive pointer semantics from a global perspective, thus guiding LLMs towards generating safe and idiomatic Rust code from a given C project. Our experiments show that PtrTrans reduces unsafe usages in translated Rust by 99.9% compared to both rule-based translation and LLM-based rewriting, while achieving an average 29.3% higher functional correctness than fuzzing-enhanced LLM methods.
Tue 7 JulDisplayed time zone: Eastern Time (US & Canada) change
16:00 - 17:20 | Code similarity and searchResearch Papers at MB 3.435 Chair(s): Ying Zou Queen's University, Kingston, Ontario | ||
16:00 20mTalk | Understanding Code Similarity across Instruction Set Architectures: An Empirical Study Research Papers Haonan Yu Institute of Software Chinese Academy of Sciences, Jiaxin Zhu Institute of Software at Chinese Academy of Sciences, Yingying Zheng Institute of Software at Chinese Academy of Sciences, Yuwei Zhang Institute of Software Chinese Academy of Sciences, Wei Wang Institute of Software at Chinese Academy of Sciences, Jun Wei Institute of Software at Chinese Academy of Sciences; University of Chinese Academy of Sciences, Tao Huang Institute of Software at Chinese Academy of Sciences Pre-print | ||
16:20 20mTalk | SBridge: Identifying Source-to-Binary Function Similarity via Cross-Domain Control Block Matching Research Papers Heedong Yang Korea University, Jeongwoo Lee Korea University, Hajin Yun Korea University, Seunghoon Woo Korea University Pre-print | ||
16:40 20mTalk | Understanding Binary Code Similarity for Real-World Vulnerability Detection: A Large-Scale Empirical Study Research Papers Jingdong Guo Institute of Information Engineering, CAS; School of Cyber Security, UCAS, Chaopeng Dong School of Cyberspace, Hangzhou Dianzi University, Yimo Ren Institute of Information Engineering Chinese Academy of Sciences & University of Chinese Academy of Sciences, China, Siyuan Li University of Chinese Academy of Sciences & Institute of Information Engineering Chinese Academy of Sciences, China, Jie Liu Institute of Software, Chinese Academy of Sciences, Hong Li Institute of Information Engineering at Chinese Academy of Sciences, Hongsong Zhu Institute of Information Engineering at Chinese Academy of Sciences; University of Chinese Academy of Sciences Pre-print | ||
17:00 20mTalk | Project-Level C-to-Rust Translation via Pointer Knowledge Graphs Research Papers Zhiqiang Yuan Fudan University, Wenjun Mao Fudan University, Zhou , Xiyue Shang Fudan University, Chong Wang Nanyang Technological University, Yiling Lou University of Illinois at Urbana-Champaign, Xin Peng Fudan University | ||