Guangyong Shang , Guangpeng Qi , Jianing Ren , Xianqi Jin , Wanjiang Shen , Junchao Li , Xiuzhen Cheng , Runyu Pan
{"title":"LwRustIP: Memory-safe and efficient embedded networking stack with ownership semantics","authors":"Guangyong Shang , Guangpeng Qi , Jianing Ren , Xianqi Jin , Wanjiang Shen , Junchao Li , Xiuzhen Cheng , Runyu Pan","doi":"10.1016/j.hcc.2025.100351","DOIUrl":null,"url":null,"abstract":"<div><div>As modern embedded systems are increasingly network connected, their protocol stacks expose themselves as a surface that is frequently attacked. While C-based implementations such as <em>LwIP</em> are efficient, their lack of memory safety induces critical vulnerabilities such as buffer overflows, dangling pointers, and use-after-free, leading to remote code execution or privilege escalation. In this paper, we present <span>LwRustIP</span>, a memory-safe embedded networking stack reimplemented in Rust and compatible with <em>LwIP</em>. We also share our development experience. <span>LwRustIP</span> replaces unsafe linked-list memory management with a custom allocator that honors the Rust ownership semantics, leverages zero-copy techniques for inter-layer packet handoffs, and applies lock-free object pools for concurrent buffer management. These design choices ensure memory safety while maintaining performance comparable to traditional C-based implementations. We deploy <span>LwRustIP</span> on ARM-based embedded platforms and evaluate its correctness, performance, and memory safety. Experimental results show that <span>LwRustIP</span> achieves memory safety without incurring measurable performance overhead compared to the original C-based implementation. Our experience highlights the practical challenges and benefits of using Rust for low-level system components and offers guidance for future efforts in memory-safe reengineering of legacy C codebases.</div></div>","PeriodicalId":100605,"journal":{"name":"High-Confidence Computing","volume":"6 1","pages":"Article 100351"},"PeriodicalIF":9.0000,"publicationDate":"2026-03-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"High-Confidence Computing","FirstCategoryId":"1085","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S2667295225000558","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2025/9/9 0:00:00","PubModel":"Epub","JCR":"Q2","JCRName":"COMPUTER SCIENCE, INFORMATION SYSTEMS","Score":null,"Total":0}
引用次数: 0
Abstract
As modern embedded systems are increasingly network connected, their protocol stacks expose themselves as a surface that is frequently attacked. While C-based implementations such as LwIP are efficient, their lack of memory safety induces critical vulnerabilities such as buffer overflows, dangling pointers, and use-after-free, leading to remote code execution or privilege escalation. In this paper, we present LwRustIP, a memory-safe embedded networking stack reimplemented in Rust and compatible with LwIP. We also share our development experience. LwRustIP replaces unsafe linked-list memory management with a custom allocator that honors the Rust ownership semantics, leverages zero-copy techniques for inter-layer packet handoffs, and applies lock-free object pools for concurrent buffer management. These design choices ensure memory safety while maintaining performance comparable to traditional C-based implementations. We deploy LwRustIP on ARM-based embedded platforms and evaluate its correctness, performance, and memory safety. Experimental results show that LwRustIP achieves memory safety without incurring measurable performance overhead compared to the original C-based implementation. Our experience highlights the practical challenges and benefits of using Rust for low-level system components and offers guidance for future efforts in memory-safe reengineering of legacy C codebases.