TL;DR
This paper introduces Femto-Containers, a novel middleware for IoT microcontrollers that enables lightweight virtualization and fault isolation for small software functions. By leveraging eBPF and formal verification, Femto-Containers offer a secure and efficient way to deploy and manage dynamic code on resource-constrained devices, bridging the gap between traditional embedded systems and modern serverless architectures.
What Problem Does This Paper Address?
The Internet of Things (IoT) is rapidly expanding, with billions of low-power microcontrollers embedded in devices we rely on daily. However, managing and updating software on these devices is a significant challenge. Traditional operating systems and virtualization techniques are too resource-intensive for these microcontrollers, which often have limited memory (tens to hundreds of kBytes) and lack features like virtual memory. This makes it difficult to deploy dynamic, isolated software functions, hindering agility, security, and the adoption of modern development practices like serverless computing and microservices. The paper aims to bridge this gap by providing a lightweight, secure, and efficient virtualization solution for these constrained environments.
Methods
The core of the solution is Femto-Containers, a middleware runtime designed to run small, isolated software functions on microcontrollers. Key aspects of their approach include:
- eBPF Virtualization: They leverage eBPF (extended Berkeley Packet Filter), a technology typically used for kernel-level packet filtering and monitoring, as the basis for their virtual machine. This is adapted for microcontrollers using an eBPF instruction set architecture (ISA) and a lightweight virtual machine (VM) core.
- Lightweight Runtime: The Femto-Container runtime is designed to be extremely small, with a minimal memory footprint (both in Flash and RAM). This is achieved by a reduced feature set compared to traditional VMs and by avoiding complex hardware assumptions.
- Fault Isolation: A primary goal is to ensure that code running within a Femto-Container does not interfere with the underlying operating system (RIOT in their case) or other Femto-Containers. This is achieved through a combination of runtime checks and, crucially, formal verification.
- Formal Verification (CertFC): The critical components – the eBPF interpreter and the pre-flight instruction checker – have been formally verified using the Coq proof assistant. This provides strong guarantees of memory and fault isolation, ensuring that code cannot access memory outside its allocated sandbox or cause crashes.
- Event-Driven Model & Hooks: Femto-Containers are executed on-demand, triggered by events within the RTOS. They are launched via pre-defined "hooks" in the firmware, providing a structured way to integrate dynamic code.
- Secure Runtime Updates: The system supports secure, over-the-air updates for Femto-Containers and their hooks using standards like SUIT (Software Updates for IoT), ensuring integrity and authenticity.
Datasets
Not discussed in the paper. The paper focuses on evaluating the performance of their Femto-Container implementation on various hardware platforms and with representative workloads.
Key Insights and Ideas
- eBPF is surprisingly suitable for IoT: The paper demonstrates that eBPF, often associated with high-performance networking and security in Linux, can be effectively adapted for ultra-lightweight virtualization on resource-constrained microcontrollers. Its small instruction set and focus on safety make it a good fit.
- Formal verification is feasible and valuable for IoT: The authors show that formal verification of critical components is achievable even for small codebases on microcontrollers, providing a strong security guarantee that is often missing in embedded systems. This significantly enhances trust in dynamic code execution.
- Trade-off between performance and verification: While the formally verified version (CertFC) incurs a slight overhead compared to the unverified eBPF runtime, the paper argues that the security benefits outweigh this cost for many IoT applications.
- Minimal overhead for significant functionality: Femto-Containers achieve a remarkably low memory footprint (around 10% overhead for functionality) and manageable execution time overhead, making them a practical solution for adding dynamic capabilities to existing IoT systems.
Key Results
- Memory Footprint: Femto-Containers based on eBPF require significantly less memory than alternatives like MicroPython, WebAssembly, or JavaScript runtimes. For example, the rBPF runtime requires only 0.6 KiB of RAM and 4.4 KiB of ROM, a substantial reduction compared to MicroPython (8.2 KiB RAM, 101 KiB ROM). The overall system with Femto-Containers adds a negligible memory overhead (around 10%) compared to native execution.
- Performance: While virtualization introduces overhead, Femto-Containers offer a good balance. Scripting interpreters like MicroPython are orders of magnitude slower than native code, whereas rBPF is significantly faster. The formally verified CertFC shows a slight performance degradation compared to the unverified rBPF but remains competitive.
- Startup Time: Femto-Containers exhibit very low cold-start overhead, ranging from microseconds to milliseconds, which is crucial for event-driven IoT applications.
- Fault Isolation: Formal verification guarantees that the underlying OS (RIOT) is shielded from arbitrary logic loaded and executed within a Femto-Container, without requiring specific hardware memory protection mechanisms.
Limitations and Future Work
- Limited Instruction Set: The eBPF ISA, while efficient, has limitations. For instance, asynchronous operations are not directly supported, and the small stack size (512 Bytes) can be a constraint for complex functions.
- Tenant Privilege Management: The current privilege system is basic, relying on pre-provisioned hooks and system calls. More sophisticated mechanisms are needed for dynamic privilege levels and finer-grained control when multiple tenants have different requirements.
- Hardware Agnosticism: While aiming for hardware agnosticism, the performance characteristics can vary across different microcontroller architectures (e.g., Cortex-M, ESP32, RISC-V).
- Future Work: The authors suggest exploring more advanced privilege management, potentially allowing applications to request more stack from the RTOS, and investigating JIT compilation for further performance improvements. They also highlight the potential for using other LLVM-compatible languages like C++ and Rust for developing Femto-Container applications.
Summary updated