LwRustIP: Memory-safe and efficient embedded networking stack with ownership semantics
Guangyong Shang , Guangpeng Qi , Jianing Ren , Xianqi Jin , Wanjiang Shen , Junchao Li , Xiuzhen Cheng , Runyu Pan
High-Confidence Computing ›› 2026, Vol. 6 ›› Issue (1) : 100351
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.
Embedded network protocol stack / Memory safety / Zero-copy architecture / Rust ownership semantics
| [1] |
|
| [2] |
|
| [3] |
PurpleSec, 9 common types of malware (& how to prevent them), 2024, (Accessed 20 April 2025), https://purplesec.us/learn/common-malware-types/. |
| [4] |
|
| [5] |
|
| [6] |
U.S. Department of Homeland Security (DHS) Cybersecurity, Infrastructure Security Agency (CISA), CVE: Common vulnerabilities and exposures, 2025, (Accessed 10 April 2025), https://cve.mitre.org/. |
| [7] |
|
| [8] |
|
| [9] |
Tock, Tock embedded operating system, 2014, (Accessed 13 April 2025), https://tockos.org/. |
| [10] |
Redox, The redox operating system, 2015, (Accessed 13 April 2025), https://tockos.org/. |
| [11] |
|
| [12] |
|
| [13] |
|
| [14] |
|
| [15] |
|
| [16] |
polyelectronics, The rust programming language for embedded sys-tems, 2024, (Accessed 25 April 2025), https://polyelectronics.us/the-rust-programming-language-for-embedded-systems/. |
| [17] |
|
| [18] |
|
| [19] |
GNOME, Librsvg: A small library to render scalable vector graphics, 2016, (Accessed 28 April 2025), https://github.com/GNOME/librsvg. |
| [20] |
|
| [21] |
|
| [22] |
|
| [23] |
Verification Infrastructure for Permission-based Reasoning, Prusti: A static verifier for rust, 2025, (Accessed 26 April 2025), https://github.com/viperproject/prusti-dev. |
| [24] |
|
| [25] |
Creusot, Creusot is a deductive verifier for rust code, 2025, (Accessed 26 April 2025), https://github.com/creusot-rs/creusot. |
| [26] |
|
| [27] |
|
| [28] |
CodeSecure, Joint strike force, 2025, (Accessed 28 April 2025), https://support.codesecure.com/hc/en-us/articles/15448705954578-Joint-Strike-Force. |
| [29] |
MISRA, MISRA c/c++, 2021, (Accessed 28 April 2025), https://misra.org.uk/. |
| [30] |
|
| [31] |
|
| [32] |
|
| [33] |
|
| [34] |
CVE, A buffer overflow vulnerability in lwIP, 2020, (Accessed 30 April 2025), https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-22283. |
| [35] |
CVE, Double free vulnerability in virtualsquare picoTCP, 2021, (Accessed 30 April 2025), https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-33304. |
| [36] |
CVE, VxWorks IPNET CVE has a NULL pointer dereference, 2020, (Accessed 30 April 2025), https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10664. |
| [37] |
CVE, Memory leak in linux TCP/IP stack, 2024, (Accessed 30 April 2025), https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-57841. |
| [38] |
RustPython, 2025, (Accessed 16 July 2025), https://github.com/RustPython/RustPython. |
/
| 〈 |
|
〉 |