Lion Cipher Lab

Write a Linux kernel module from scratch (and load it into a throwaway VM)

Why it matters

Almost everything you have ever run is a user-space program: the kernel hands it a fenced-off sandbox, and when your program does something illegal — dereferences a null pointer, walks off the end of an array — the kernel simply kills that one process and the rest of the machine shrugs. A kernel module is the other side of that fence. It is code you compile and then splice directly into the running kernel, where it executes with FULL kernel privilege: it can touch any memory, talk to hardware, and there is no bigger adult in the room to catch its mistakes. That is exactly why device drivers,…

What you'll learn

Steps in this lab

  1. The boundary you are about to cross
  2. Why a throwaway VM, and nothing else
  3. Install the toolchain and the kernel headers
  4. Write the module: your first code in kernel space
  5. Write the Makefile that compiles against your kernel
  6. Compile it — and read what you got
  7. Load it, watch it, inspect it, unload it
  8. Make it DO something: a live /proc entry
  9. The security lens: privilege, tainting, signing, and lockdown
  10. What you built — and the reflex to keep

Open the full interactive lab →