Femto-Containers: DevOps on Microcontrollers with Lightweight Virtualization & Isolation for IoT Software Modules

Koen Zandberg, Emmanuel BaccelliarXiv 2021 · OpenReview

TL;DR

This paper introduces Femto-Containers, a novel architecture that brings DevOps practices like containerization and virtualization to resource-constrained microcontrollers in the Internet of Things (IoT). By leveraging eBPF and a lightweight RTOS, Femto-Containers enable secure, agile deployment and management of software modules with minimal overhead, bridging a critical gap in IoT development.

What Problem Does This Paper Address?

The world of networked software has been transformed by DevOps, enabling rapid development, deployment, and maintenance. However, the explosion of low-power, microcontroller-based IoT devices has been largely left behind. These devices, ubiquitous in smart systems, lack the resources (memory, processing power) to support traditional DevOps tools like Docker or full OS virtualization. This creates a significant bottleneck, hindering agility, security, and efficient management of these devices. The authors aim to bridge this gap by providing a solution that brings containerization and virtualization to these constrained environments.

Methods

The core of the Femto-Containers architecture is a novel approach to virtualization and containerization tailored for microcontrollers. Instead of the cloud-native model of containers within large VMs, Femto-Containers flip this: they host small, lightweight virtual machines (VMs) within simplified containers.

Key techniques include:

  • eBPF Virtualization: The paper leverages eBPF (extended Berkeley Packet Filter), a technology typically used for in-kernel packet filtering and debugging in Linux. They adapt eBPF's lightweight virtual machine and instruction set for microcontrollers, enabling secure, on-the-fly execution of code.
  • RIOT OS Integration: The implementation is built on top of RIOT, a popular real-time operating system (RTOS) for IoT devices. Femto-Containers are scheduled as regular threads within RIOT, allowing for concurrent execution and resource sharing.
  • Lightweight Containerization: Each Femto-Container provides a minimal, sandboxed environment around the VM, exposing only necessary RTOS facilities through system calls. This ensures isolation and abstraction from the underlying OS.
  • Event-Driven Execution: Containers are designed to be executed on-demand, triggered by events within the RTOS (e.g., sensor readings, network packets). This aligns with the typically short-lived nature of IoT tasks.
  • Security and Isolation: The architecture incorporates several security features, including pre-flight instruction checks, memory access control via whitelists, and isolation between containers and the host OS.

Datasets

Not discussed in the paper. The authors focus on evaluating their system using synthetic workloads and specific use-case prototypes.

Key Insights and Ideas

  • Flipping the Virtualization Model: The core innovation is reversing the traditional container-in-VM model to a VM-in-container approach. This drastically reduces the resource overhead, making virtualization feasible on microcontrollers.
  • eBPF as a Microcontroller VM: Adapting eBPF, a technology known for its efficiency and security in Linux, for microcontrollers is a significant contribution. It provides a robust foundation for lightweight, secure code execution.
  • DevOps for the "Weakest Link": The paper highlights that low-power IoT devices are the "weakest link" in modern cyber-physical systems. Femto-Containers directly address this by enabling DevOps practices where they were previously impossible.
  • Minimal Overhead is Achievable: The results demonstrate that it's possible to achieve containerization and virtualization with very low memory footprint (below 10% overhead) and fast startup times (tens of microseconds), making it practical for resource-constrained devices.
  • Security Without Hardware Extensions: The solution achieves strong isolation and security guarantees through software-based mechanisms, avoiding the need for specialized hardware like Memory Protection Units (MPUs) or TrustZone, thus increasing applicability to a wider range of devices.

Key Results

  • Memory Footprint: Femto-Containers exhibit very small memory footprint overhead, with ROM usage increasing by less than 10% compared to a basic rBPF interpreter. RAM usage for the hosting engine is also minimal (664 B per VM instance).
  • Startup Time: Startup times are in the order of tens of microseconds, significantly faster than many scripting-based approaches and comparable to native execution for subsequent runs after initial checks.
  • Execution Speed: While slower than native code, Femto-Containers offer a significant performance improvement over scripting languages like MicroPython and RIOTjs. For example, rBPF (the basis for Femto-Containers) is 77 times slower than native code, whereas MicroPython/RIOTjs are over 600 times slower.
  • Concurrency: The system can host multiple containers concurrently, even from different tenants, on a single microcontroller, demonstrating scalability.
  • Hardware Support: The architecture was successfully implemented and evaluated on popular microcontroller architectures: Arm Cortex-M, ESP32, and RISC-V.

Limitations and Future Work

  • Limited Instruction Set: The eBPF instruction set, while efficient, has limitations. Asynchronous operations are not directly supported, and the small stack size (512 Bytes) might require special handling for memory-intensive tasks.
  • Tenant Privilege Management: The current privilege management system is basic, relying on pre-provisioned hooks. More dynamic and granular control over tenant privileges is needed.
  • Install-time vs. Execution-time: While eBPF bytecode is interpreted, transpiling it to native code at install-time could offer performance gains at the cost of increased install-time overhead.
  • Formal Verification: The authors suggest that the small codebase of the hosting engine presents an opportunity for formal verification to provide stronger security guarantees.
  • Dynamic Memory Allocation: The current design relies on a key-value store and does not support dynamic memory allocation in the traditional sense, which might limit certain types of applications.

Future work could explore dynamic memory allocation, more sophisticated tenant privilege management, and potentially ahead-of-time compilation for performance-critical applications.

Summary updated

Abstract

Development, deployment and maintenance of networked software has been revolutionized by DevOps, which have become essential to boost system software quality and to enable agile evolution. Meanwhile the Internet of Things (IoT) connects more and more devices which are not covered by DevOps tools: low-power, microcontroller-based devices. In this paper, we contribute to bridge this gap by designing Femto-Containers, a new architecture which enables containerization, virtualization and secure deployment of software modules embedded on microcontrollers over low-power networks. As proof-of-concept, we implemented and evaluated Femto-Containers on popular microcontroller architectures (Arm Cortex-M, ESP32 and RISC-V), using eBPF virtualization, and RIOT, a common operating system in this space. We show that Femto-Containers can virtualize and isolate multiple software modules, executed concurrently, with very small memory footprint overhead (below 10%) and very small startup time (tens of microseconds) compared to native code execution. We show that Femto-Containers can satisfy the constraints of both low-level debug logic inserted in a hot code path, and high-level business logic coded in a variety of common programming languages. Compared to prior work, Femto-Containers thus offer an attractive trade-off in terms of memory footprint, energy consumption, agility and security.
BibTeX
@misc{zandberg2021femto,
  author = {Koen Zandberg and Emmanuel Baccelli},
  title = {{Femto-Containers: DevOps on Microcontrollers with Lightweight Virtualization \& Isolation for IoT Software Modules}},
  year = {2021},
  eprint = {2106.12553},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2106.12553},
}
Figure