We aim to explore conditional memory safety guarantees and performance impacts of integrating Rust code into a C codebase. While Rust's memory safety guarantees are well-documented, it's often impractical to port entire codebases to Rust. Existing studies typically compare complete Rust-based codebases with complete C-based ones, which may not reflect real-world scenarios for legacy codebases. Documentation on Rust and C integration approaches is sparse, and roadblocks and solutions are not well-documented. Our goal is to study integration approaches that provide maximum memory safety guarantees and performance improvements.
We chose Microps as a case study—a GitHub project offering an educational implementation of a TCP/IP protocol stack. The repository contains various source code files, each handling specific aspects of network communication.
arp.c
: Address Resolution Protocol (ARP).ether.c
: Ethernet protocol-related functions.icmp.c
: Internet Control Message Protocol (ICMP) messages.ip.c
: Internet Protocol (IP) code.net.c
: Central component for integrating various protocol layers.sock.c
: Socket operations for network communication from the application layer.tcp.c
: Transmission Control Protocol (TCP) implementation.udp.c
: User Datagram Protocol (UDP) handling.utils.c
: Utility functions, including a queue data structure and file/data handling.
We ported utils.c
to Rust with a focus on providing conditional memory safety guarantees by managing memory allocation and access in Rust.
- [@Joel]: Mention any relevant information about tests and benchmarking here.
/doc
: Milestone 1 ppt, project proposal, README./tests
: Test cases./code_orig
: Original Rust code (lib.rs
), dummy code with queue integration,/integration
(modified ICMP and Makefile inside),/integration_examples
./code-external
: Original Microps code./results
: Benchmarking results./identified_errors
: Documented errors.
- [List any planned future work or improvements]