Year: 2025
Type: dissertation
Abstract: Memory safety is a critical concern in embedded systems. Resource constraints and real-time requirements demand efficient and robust solutions. Most systems are usually implemented with a low-level language like C. C, in particular, gives the developer total freedom over the hardware. However, with this freedom comes the responsibility of ensuring memory safety, which can be very difficult in complex systems. Rust partially solves this by ensuring defined behavior and memory safety unless the keyword unsafe is used. Unsafe code is necessary because the Rust compiler denies direct access to the hardware, even when it is essential. Within this unsafe space lies the problem and the focus of this thesis. The primary contribution of this thesis is a hardware-level proof-of-concept: a modified RISC-V RT system with a physical memory protection mechanism featuring per-task configuration. This solution leverages the per-task configuration to achieve zero overhead, requiring only a few lines of assembly for setup. Without setup, each task is restricted to its own stack. However, by writing to the Control and Status Register (CSR), additional allowed memory areas can be defined in a single cycle. Physical memory protection can improve memorysafety in all languages, including (memory) unsafe code in Rust. To ensure a constant configuration, a locking mechanism has been added. This locking mechanism can lock any CSR address in hardware, making it permanent until a system reset. This ensures stack isolation and raises exceptions in cases of buffer overflows or use-after-free errors. These exceptions can simplify error identification and contribute to a more robust system. The current physical memory protection, as proposed, has great potential for security. However, it relies on correct configuration, and this responsibility falls upon the user to set it up correctly. A potential future improvement is to automate this process by generating code during compilation to simplify setup and ensure task isolation.
Author: Asplund, Marcus
Institution: Luleå University of Technology
Language: English
Subfield: Hardware and Architecture
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W6997510166
