Tock: From Research to Securing 10 Million Computers
This page was written by an AI model to give a high-level overview of the paper. Please check the paper for detail: ACM Digital Library.
Tock began in 2015 as a research operating system for urban sensing platforms such as Signpost: 32-bit Cortex-M microcontrollers with about 100 kB of RAM, under 1 MB of flash, no virtual memory and only a simple memory protection unit (MPU). Most embedded systems on such hardware run every driver and application in one protection domain, with no isolation and no system call interface. Tock instead set out to run several mutually distrustful applications safely on one small chip, which its 2017 SOSP paper described as "Multiprogramming a 64 kB Computer Safely and Efficiently".
The design rests on two kinds of isolation. Kernel extensions, called capsules, are Rust code in crates where unsafe is forbidden, so the type system confines each capsule to its own state at compile time with virtually no runtime cost. Applications run as processes, written in any language, isolated by the MPU and preemptively scheduled. The kernel has no heap: per-process kernel state lives in grants inside the process's own memory, so a process can exhaust only its own memory. The kernel and the system call interface are fully asynchronous, which lets the chip sleep whenever there is no work.
The paper is an experience report on the decade since. Tock's main users turned out to be hardware roots of trust, the small security chips that store keys and verify boot images: Google's OpenSK security key and its Ti50 firmware for Chromebooks, root-of-trust chips in data center servers, and a Tock-based Pluton (the paper's Figure 1). The paper says Tock now runs on tens of millions of computers. These users matched the original hardware and isolation needs closely, but not the energy constraints. Asynchronous system calls made sequential security code verbose; one adopter (Oxide) left to write its own synchronous Rust OS, Hubris, and another (Ti50) forked to add a blocking call. Supporting Rust applications soundly forced a redesign of the system call ABI, the kernel loop and the capsule interface, released as Tock 2.0 in 2021.
The paper's lessons about Rust cut both ways. Its type system did more than memory safety: Tock uses types to reject invalid driver compositions at compile time, to pass parts of a buffer between layers without losing the rest (SubSlice), to describe memory-mapped device registers, and to gate privileged kernel APIs behind zero-cost capability tokens. But Rust's aliasing and validity rules are easy to break at the boundary with code the compiler cannot see, such as C applications sharing buffers with the kernel; Tock's first implementation of buffer sharing was unsound in two ways. Rust also gave little help with reusing libraries or avoiding logic bugs. The kernel grew from roughly 2 to 12 thousand lines between 2017 and 2025 while its count of unsafe blocks grew far less (values read from the paper's Figure 5).
Finally, the paper reflects on running a production OS from academia. Over three quarters of Tock's current leadership team are academics. Academic stewardship let Tock survive its early years with "essentially zero funding" and gave it a long horizon for breaking changes, but engineering work without research questions (for example hardware-in-the-loop testing) and product-driven forks were persistent problems. The paper reports experience, not a performance evaluation.
Key takeaways
- Tock runs several isolated applications on microcontrollers with tens to hundreds of kB of RAM: capsules are isolated by Rust's type system, processes by the MPU, and a heapless kernel keeps per-process state in grants.
- Its widest adoption came from hardware roots of trust (OpenSK, Ti50 on Chromebooks, data center servers, Pluton), not the sensor networks it was built for; the paper says it now runs on tens of millions of computers.
- The fully asynchronous system call interface suited low-power sensing but burdened sequential security applications; it cost Tock one adopter (Oxide, which wrote Hubris) and led to a fork (Ti50).
- A sound Rust userspace required Tock 2.0: swapping semantics for
allowandsubscribe, kernel-held buffers, a read-onlyallow, and a clean break with old applications. - Rust's types enabled compile-time checks well beyond memory safety, but its invariants are easy to violate at the boundary with untrusted code, and it does not prevent logic bugs; academic stewardship gave Tock time to get designs right, at the cost of gaps in engineering work.
Tock's design, how a decade of deployments changed it, and what Rust taught
The original constraints and design, the root-of-trust adopters, the system call redesign, Rust's benefits and pitfalls, and running the project from academia.
1 · The computers Tock targets
Tock was designed for multiprogrammed, battery-powered or energy-harvesting sensor platforms. Its first deployment was Signpost, a network of sensing units across two university campuses; each unit had several interconnected boards with sensors and WiFi, LoRa and Bluetooth radios, ran both common and site-specific applications, and was solar powered. The root-of-trust devices that later adopted Tock turned out to look much the same, except for energy.
| Property | Original target (Section 2) | Hardware roots of trust (Section 3.1) |
|---|---|---|
| CPU | 32-bit Cortex-M | a single core, typically 32-bit |
| Memory | ~100 kB RAM, under 1 MB of executable flash | tens or hundreds of KB |
| Protection | no virtual memory, primitive memory protection | no virtual memory, single-address-space memory protection |
| Peripherals | many on-chip peripherals and accelerators, a radio | many specialized, sometimes proprietary accelerators, especially for cryptography |
| Applications | several isolated, possibly buggy or malicious, concurrent applications | several independently developed applications, portable across hardware versions, in Rust and existing C |
| Energy | tight: maximize time in hardware sleep states | not constrained, or much less so (USB power; duty cycle set by human reaction times) |
Typical embedded frameworks for this class of hardware (the paper cites FreeRTOS, Zephyr and NuttX) give every component unbridled access to the system and memory, compile all functionality into one image, have no system call interface, and avoid heap allocation because resource exhaustion is hard to reason about.
2 · The original design
Tock divides a system into four kinds of components (the paper's Figure 2, redrawn on The Big Idea tab):
| Component | Isolated by | Trusted for | Scheduling |
|---|---|---|---|
| Processes | MPU and CPU privilege modes | nothing; mutually distrustful | preemptive |
| Capsules | Rust's type system: crates where unsafe is forbidden | liveness only (no busy-waiting, no kernel panic) | cooperative |
| Chip-specific drivers | none | everything; may use unsafe for MMIO | in kernel |
| Core kernel | none | everything | runs the scheduler |
- Interior mutability. Rust allows either one mutable reference or many shared immutable ones to an object, never both. Two kernel components that call each other (a file system calling a storage driver, which calls back on completion) form a circular reference, which the compiler cannot accept with mutable references. Tock considered a central message broker and chose interior mutability instead: components hold shared references to each other and mutate state through types that permit it, at the cost of some runtime checks and care about reentrant calls.
- Capsules. Most non-privileged kernel code, including system call drivers and virtualizers (components that multiplex one peripheral among several users), is written as capsules. The approach follows SPIN (Modula-3) and Singularity (Sing#), but Rust's ownership types avoid garbage collection and dynamic allocation.
- Processes. Hardware-isolated processes let developers split complex state machines into separate applications in different languages (for example C and Lua) without rewriting them in Rust. This later became a formal threat model: application data stays secret even from the kernel unless revealed, and applications cannot deny service to each other.
- Grants and no heap. The kernel has only static allocations and its stack. Kernel state related to a process is allocated in that process's memory region and hidden from the process by the MPU, so a process can only exhaust its own memory and the state never outlives the process.
- Asynchronous all the way down. The kernel is event-driven with a single stack and uses split-phase operations (a call to start, a callback on completion), as in TinyOS. Tock predates Rust's native async support and uses callbacks and circular references instead. The system call interface is asynchronous too (Section 4 below).
3 · Who adopted it
Soon after its first release, Tock attracted companies and non-profits building hardware root-of-trust chips, the devices that store keys, verify boot images and are the first step in checking that a system is not compromised. Early adopters were two Google products: OpenSK, a FIDO-compliant second-factor authentication (2FA) device, and Ti50, a root of trust for Chromebook laptops. Vendors of data center server roots of trust and other end-user device makers followed. The paper's Figure 1 also marks "Tock-based Pluton", and the abstract adds automotive and space products, wearable electronics and hardware security tokens.
| Year (Figure 1) | Development | Deployments | Research |
|---|---|---|---|
| 2015 to 2016 | initial commit, interior mutability, grants | Signpost deployed | |
| 2017 to 2018 | 1.0 release | SOSP '17 paper | |
| 2019 to 2020 | RISC-V support | OpenSK released | |
| 2021 to 2022 | 2.0 release, Tock on Chromebooks | automated clock management, formal threat model | |
| 2024 to 2025 | x86 support | Tock-based Pluton | verified isolation (TickTock) |
4 · Asynchronous system calls, and why adopters pushed back
To run a long operation (the paper's example is printing a buffer over a UART), an application shares a buffer with the kernel (allow), registers a callback called an upcall (subscribe), starts the operation (command), is free to do other work, and finally calls yield to wait until the kernel delivers the upcall.
This design let sensor nodes overlap I/O and sleep longer, but root-of-trust devices are barely energy constrained, and their applications are usually sequential state machines. Two early adopters reacted differently:
- Oxide wanted Tock for the firmware of its baseboard management controller (BMC). With a fixed set of sequential applications, it judged the complexity of asynchrony in the kernel, plus the complexity of turning it back into a synchronous API in userspace, not worth it. After a few months it wrote a new synchronous Rust OS, Hubris.
- Ti50 forked Tock early, under a tight shipping schedule, and added the blocking command shown above, because immature LLVM code generation for RISC-V made system calls expensive in code space. Other developers were interested in the call, but once Ti50 had forked it had little reason to drive the change upstream, and the fork and mainline have since diverged.
Mainline Tock later added a new variant of yield that makes it simpler to build synchronous libraries on the asynchronous interface. The paper reports that some users today are indifferent to the choice while others consider asynchrony essential for their root-of-trust and automotive applications.
5 · Making a Rust userspace sound: Tock 2.0
Almost all early Tock applications were in C. When adopters asked for Rust applications, the team found its Rust userspace library was unsound, and the cause was in the kernel's interface, not the library.
- The problem.
allowshares data andsubscribeshares code (a function pointer) with the kernel. The original capsule API validated these and handed capsules ownership of wrappers around them. When an application revoked a buffer by callingallowagain, the capsule was supposed to drop the old one, but nothing enforced this: a capsule could keep the old wrapper indefinitely. A Rust application cannot track which references are live if a semi-trusted kernel extension can hold them arbitrarily. - Swapping semantics. Both calls now return the previously shared buffer or function pointer (on the first call, an empty buffer or a "null" callback), as TinyOS manages buffers. Userspace keeps a reference alive while the kernel holds it.
- Kernel-held resources. The kernel, not capsules, now holds shared buffers and callbacks. Capsules reach them only through temporary references inside closures, so they cannot take ownership. This required rewriting the core kernel loop.
- Read-only allow. A new variant grants the kernel read-only access. Root-of-trust applications keep public keys in read-only flash and pass them to kernel cryptography; without it they had to copy keys into RAM, or risk the kernel writing to flash and causing an unrecoverable fault.
- A clean break. Supporting old and new ABIs side by side cost too much code space, so Tock 2.0 broke existing applications. The need was first apparent in early 2019, work on 2.0 started in early 2020, the first draft of the new system call documentation appeared in mid 2020, and 2.0 was released in mid 2021.
6 · Process loading and external code
- Signed applications. In an early root-of-trust use, a trusted bootloader verified one signed image containing Tock and its applications, which needed no kernel changes. A later use signed applications individually, so the kernel had to check each binary before running it. Hardware cryptography is asynchronous, so loading became a state machine: structural and header integrity, then cryptographic integrity and authenticity, then runnability. This made loading new applications without a reboot much easier, but added code that single-image systems did not need, so the synchronous or asynchronous loader is chosen at compile time.
- External dependencies.
unsafecode in a dependency can break the safety the whole system relies on, so Tock initially allowed only Rust'scorecrate. It has since made an exception for certain cryptography libraries with limited dependency trees and robust maintenance. Trusting third-party code for other uses, such as network protocols, remains an open research problem.
7 · What Rust's type system enabled
Beyond memory and type safety, Tock encodes higher-level system properties in types, all checked at compile time and without dynamic allocation:
| Mechanism | Problem | What the types do |
|---|---|---|
| Checked composition (Section 4.1) | A hardware-agnostic driver can be wired to a chip driver whose assumptions differ. Example: an LCD needs an active-high SPI chip-select pin, and one of a chip's SPI controllers supports only active-low. | Drivers state the capabilities they provide and clients the ones they require, using constant parameters in types; a mismatch is a type error. |
| SubSlice (Section 4.2) | Split-phase APIs pass 'static buffers whose ownership moves to the callee. Passing a sub-range gives up the rest forever, and earlier APIs passing slice, offset and length were error-prone. | A layer sees only the valid sub-range but the full buffer can be restored later; const parameters let layers state buffer sizes so callers allocate them statically. |
| MMIO abstractions (Section 4.3) | Turning datasheets into register addresses, packed structs and bit shifts is tedious and error-prone. | A macro-based language mirrors the datasheet; each register is a type exposing only its legal reads or writes, with typed fields, and bit-manipulation code is generated. |
| Capabilities (Section 4.4) | unsafe is all or nothing: it cannot say which kernel modules may, for example, stop a process. | Privileged functions take a zero-sized capability argument that only trusted platform setup can create, so an unprivileged capsule cannot call them; the cost at runtime is zero. |
8 · Where Rust bit back
- Aliased application memory. An application can
allowthe same buffer twice, giving a capsule two mutable references to the same memory, which breaks Rust's "aliasing XOR mutability" rule; such violations have led to exploitable bugs elsewhere. The compiler cannot see this (applications are compiled separately), and a runtime overlap check costs too much on Tock's hardware. Tock instead weakened the type: shared buffers are slices of interior-mutable cells (&[Cell<u8>]), so the compiler no longer assumes their contents are stable. - Null zero-length buffers. Applications reclaim a buffer by allowing a zero-length one, and the kernel built a reference from the user's pointer even when it was null. Rust requires references to be non-null and uses that for niche filling (for example encoding
Noneas null), so this was unsound. Tock now checks at runtime and uses an artificial non-null pointer. - Little guidance on
unsafe. Forbiddingunsafein whole crates gave contributors clear rules, but inside crates that permit it, developers used it in new ways and built on top of those uses. Tock has also at times usedunsafefor functional correctness beyond Rust's narrower definition of safety (no undefined behavior). In hindsight, the paper says, more abstractions aroundunsafe, like capabilities, would have helped. - Few reusable libraries. Most Rust drivers and libraries are blocking, assume a different execution model, or use Rust's
Futures, which the paper found have significant overheads compared with Tock's callbacks. Auditing external code and its dependency tree is also hard. - Logic bugs remain. Rust does not help with logical correctness. Timer virtualization and memory protection have had numerous subtle logic bugs, and the team is exploring verification techniques integrated with Rust.
9 · Running a production OS from academia
Tock was not transferred to one company or spun into a startup. Over three quarters of its current leadership team are academics, and much of the core and security-sensitive development is done by faculty and students; at least 400 people have contributed.
| Challenges (Section 6.1) | Benefits (Section 6.2) |
|---|---|
| "Solved problems" that need engineering, not research, get neglected. Some lesser-used platforms were broken for weeks or months; an automated hardware-in-the-loop test framework was built only after years, by contracting a full-time engineer. | Academia sheltered Tock in the early years before outside adoption, when it ran with "essentially zero funding" instead of having to prove itself for startup funding. |
| Product deadlines cannot wait for academic discussion, which leads to forks and downstream additions. These often do not flow back; the team has more than once re-created features an industry user had built but never shared. | A long horizon away from product deadlines, including resisting unsafe shortcuts and taking time over breaking changes such as the 2.0 system call redesign. |
| Students: undergraduates gain systems experience and add drivers; graduate students have used Tock for research on clock management, isolating C libraries in Rust, compile-time buffer sizes, code size and verification. |
10 · Open questions the paper states
- Trusting third-party code. Whether external code can be integrated safely into an OS kernel is open; the paper expects tooling will be needed to analyze and monitor external packages across updates.
- Correctness beyond safety. Subsystems with subtle logic, such as timer virtualization and memory protection, call for verification integrated with Rust; the paper cites recent verified-isolation work on Tock (TickTock).
- Containing
unsafe. Keepingunsafeuse low has required continuous maintenance, and the paper suggests more guiding abstractions would have helped. - Synchronous versus asynchronous. The paper reports divided user opinion on the asynchronous system call interface rather than a settled answer.
FAQ
Q·What are the "10 million computers"?▾
The paper does not break the number down. It says Tock is deployed on root-of-trust hardware in data center servers and on millions of laptops, and describes the total as tens of millions of computers. Named deployments include Google's OpenSK security key, Ti50 on Chromebooks, server roots of trust and a Tock-based Pluton, with automotive, space, wearable and security-token products also mentioned.
Q·How is Tock different from FreeRTOS or Zephyr?▾
In the paper's description, typical embedded frameworks give every component (drivers, virtualization layers, applications) unrestricted access to the system and memory, compile all functionality into one image, and have no system call interface. Tock separates a kernel from applications: applications are hardware-isolated processes behind a narrow system call interface, kernel extensions are isolated from each other by Rust's type system, and applications can be loaded, started and stopped individually.
Q·How does it compare with other Rust operating systems, such as Hubris or Theseus?▾
Hubris came out of Tock's history: Oxide tried Tock for its baseboard management controller and, finding asynchrony a poor fit for a fixed set of sequential applications, wrote Hubris as a synchronous Rust OS. Theseus requires all OS components and applications to be written in Rust so the compiler can check everything. The paper argues that is impractical for real devices, which must run legacy C code, and that process isolation brings important benefits.
Q·If capsules are isolated only by the type system, what can a buggy capsule still do?▾
Because capsules cannot use unsafe, they can only touch their own state and the safe APIs they are given, so they cannot corrupt other memory. They are trusted for liveness: a capsule that busy-waits or panics can still stall or crash the kernel, since capsules are cooperatively scheduled. That is the meaning of "semi-trusted" in the paper.
Q·Why does the kernel have no heap?▾
With a shared kernel heap, one application could keep requesting kernel resources and starve the others. Tock uses only static allocations and the kernel stack; dynamic, per-process kernel state goes into grants inside the process's own memory, protected from the process by the MPU. A process can then exhaust only its own memory, and its kernel state disappears with it.
Q·Why were asynchronous system calls a problem for root-of-trust users?▾
The asynchronous design saves energy by letting one thread overlap many operations, which mattered for solar-powered sensors. Roots of trust are barely energy constrained, and their applications are usually sequential state machines, so a simple "wait for a response with a timeout" becomes about half a dozen system calls. On Ti50's RISC-V chip each system call was also expensive in code space. The paper reports that some users are now indifferent while others consider asynchrony essential.
Q·Why did Tock 2.0 break existing applications?▾
Making a Rust userspace sound required changing how allow and subscribe behave (they now swap and return the previous buffer or callback, and the kernel rather than capsules holds them), plus a new read-only allow. Keeping the old and new ABIs side by side would have cost too much code space on these devices, so the project made a clean break.
Q·Where does Tock still use unsafe?▾
Never in capsules. In the kernel, the paper says it is limited to places that interact with hardware or software outside Rust's types (MMIO registers and the process boundary) and to creating the capabilities that restrict sensitive kernel APIs. The paper's Figure 5 shows the number of unsafe blocks growing much more slowly than the kernel, but notes that keeping it low takes continuous maintenance.
Q·Can Tock use ordinary Rust crates?▾
Mostly not. Most libraries are blocking or use Rust Futures, which do not fit the single-stack, callback-based kernel (the paper found Futures have significant overheads in comparison). Tock also treats any external unsafe code as a trust problem: it originally allowed only the core crate and now makes exceptions for a few well-maintained cryptography libraries with small dependency trees.
Q·Does Rust prevent the bugs that matter in an OS kernel?▾
It prevents memory-safety bugs in safe code, but the paper found its invariants easy to break at the boundary with untrusted applications (two examples are aliased shared buffers and null zero-length buffers), and it does not help with logic errors. Timer virtualization and memory protection had numerous subtle logic bugs, which is why the team is pursuing verification.
Q·Why keep the project in academia instead of a company?▾
The paper does not frame it as a single decision; it describes how the project evolved and what followed. Academia let Tock survive its first years with essentially no funding and gave it the patience for designs such as the 2.0 system call redesign. The costs were engineering gaps, such as years without hardware-in-the-loop testing, and features from industry forks that never flowed back.
Q·Does the paper include a performance evaluation?▾
No. It is an experience paper. Its quantitative data are the timeline of Figure 1 and the code-size and unsafe counts of Figure 5; claims about overheads (for example of Futures or of runtime overlap checks) are stated qualitatively. The original design's costs were evaluated in the earlier SOSP '17 paper (general knowledge).
unsafe RustCode marked to allow operations the compiler cannot check, such as dereferencing raw pointers; the programmer must uphold Rust's invariants by hand. It can be forbidden for a whole crate.Cell) allows its contents to be changed through a shared reference, with the type enforcing safe access.unsafe is forbidden, used for system call drivers and virtualizers, isolated by the type system and trusted only for liveness.allow, subscribe, command, yieldTock system calls that, respectively, share a buffer with the kernel, register an upcall, start an operation in a driver, and wait for upcalls to arrive.None of an optional reference as a null pointer.