Black Friday Deals For Authors Are On Now!

Leanpub Header

Skip to main content

Systems from Scratch: The Four-Book Bundle

Four hands-on systems books for one price: hardware sandboxes, confidential computing, eBPF and io_uring, each built from scratch and run on real machines.

Bought separately

$47.96

$9.99

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

These books have a total suggested price of $47.96. Get them now for only $9.99!
About

About

About the Bundle

Four books on how Linux systems work underneath, written the same way: start from the lowest layer, build the mechanism yourself, run it on real machines and show the real output.

Hardware Sandboxes from Scratch: run untrusted code, such as commands from AI agents, in a KVM sandbox with a small Rust supervisor and no guest kernel.

Confidential Computing from Scratch: keep a VM's memory and secrets away from the cloud that runs it, with AMD SEV-SNP and Intel TDX, and verify their attestation reports by hand.

eBPF from Scratch in Rust: run your own code inside the Linux kernel safely, for tracing, networking and security.

io_uring from Scratch in Rust: fast, asynchronous I/O on Linux with the kernel's shared rings, for files, sockets and databases.

Bought one at a time, the four books cost at least $23.96. Here you get all four, PDF and EPUB, for $9.99, with free updates when the books change. The code for every book is on GitHub at github.com/allthingssecurity.

Books

About the Books

Hardware Sandboxes from Scratch

Hardware Sandboxes from Scratch

From the instruction pointer to a KVM sandbox for AI agents

This book builds a sandbox from nothing: a small virtual machine, enforced by the CPU, that runs a program you don't trust and lets it touch only what you allow.

It is for beginners and mid-level programmers who know some C or Rust and the Linux command line. It starts at the CPU's instruction pointer, privilege levels and page tables, goes through a first Linux device driver and a hand-made container, then builds KVM virtual machines in C and Rust, and ends with the full sandbox: a VM with no kernel inside, for running AI agents' tool calls, including the Python, JavaScript and Lua scripts they write.

About 180 pages, 19 chapters in three parts, 59 figures. Every listing builds and every output shown comes from a real run in the lab described in chapter 2. The sandbox targets 64-bit Arm; Part I works on any Linux machine. The code is at https://github.com/allthingssecurity/kvm-agent-sandbox

Confidential Computing from Scratch

Confidential Computing from Scratch

Keeping a VM's secrets from the cloud that runs it, with AMD SEV-SNP and Intel TDX

This book explains confidential computing from the ground up: how AMD SEV-SNP and Intel TDX keep a virtual machine's memory and secrets away from the cloud that runs it, how a remote party checks what a VM booted before trusting it with a key, and where those guarantees stop.

It is for programmers and architects. It starts with what "data in use" means and who you have to trust, rents real confidential VMs on Google Cloud and asks them for signed reports. Then it covers encrypted memory, the launch flows, what gets measured and what it costs, verifies an AMD report and an Intel TDX quote from scratch, builds a small key broker that releases a secret only to a VM it trusts, shows what the measurement doesn't see, and ends with the known attacks and the design of a complete confidential system.

About 200 pages, 15 chapters in three parts, 43 figures. Every listing ran on real Google Cloud SEV-SNP and TDX VMs, and every output shown is copied from those runs. The code is at https://github.com/allthingssecurity/confidential-computing-from-scratch

eBPF from Scratch in Rust

eBPF from Scratch in Rust

Running your own code inside the Linux kernel, safely: tracing, networking and security

This book shows how to run your own Rust code inside the Linux kernel safely, for tracing, networking and security. It builds the eBPF machine before using it: raw instructions loaded through the bpf() system call, a small interpreter and a toy verifier. Then it moves to Aya, CO-RE and real tools: maps, hooks and what each one costs, finding why a checkout is slow and which function eats the CPU, XDP and TC for packets, LSM programs that watch code you didn't write, sched_ext, and the limits and attacks you should know about. It ends with the design of a complete eBPF agent. It is for programmers and architects. About 300 pages, 17 chapters, 45 figures. Every listing ran on real Google Cloud VMs, and every output shown is copied from those runs. The code is at https://github.com/allthingssecurity/ebpf-from-scratch-in-rust

io_uring from Scratch in Rust

io_uring from Scratch in Rust

Fast, asynchronous I/O on Linux: files, sockets and the kernel's shared rings

This book shows how io_uring works and how to use it from Rust, for files, sockets and databases.

It builds the machine before using it: a ring set up by hand with nothing but the libc crate, three mmaps, the memory barriers and io_uring_enter. Then it covers submissions and completions, where the kernel really runs each request, batching and registered buffers, chains and timeouts, and the main Rust libraries side by side. Along the way it builds kvring, a small Redis-compatible server: an io_uring network layer for 5,000 clients, its own async runtime, group commit for its log, and a final design. PostgreSQL 18, MariaDB, Redis, Valkey and Dragonfly are measured on the same machines. It ends with security, and with the cases where io_uring is not faster.

It is for programmers and architects. About 290 pages, 17 chapters in four parts, 48 figures. Every listing ran on real Google Cloud VMs, and every output shown is copied from those runs. The code is at https://github.com/allthingssecurity/iouring-from-scratch-in-rust

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub