kpmlisted
Install: claude install-skill yspbwx2010/skills
# KernelPatch Module (KPM)
A KPM is a **partially-linked arm64 ELF relocatable object** (`.kpm`) that KernelPatch loads
and executes **in kernel space**. It is not a normal Linux `.ko` — it depends on nothing but the
symbols KernelPatch exports, so the same `.kpm` runs on many kernels without their source or
`Module.symvers`. Use a KPM to inline-hook a kernel function, hook a syscall, or reach arbitrary
kernel functions found by name at runtime.
This skill is written against **KernelPatch 0.13.9**. Everything here is verified against that
source; APIs on `main` may differ.
## Before you write anything
1. **You need the KernelPatch source** for its headers (the build `-I`s into it). Clone the release
tag, not `main`:
```sh
git clone --depth 1 --branch 0.13.9 https://github.com/bmax121/KernelPatch
```
Set `KP_DIR` to that checkout (the demo Makefiles default it to `../..`).
2. **You need an arm64 bare-metal toolchain.** The upstream, CI-blessed one is
`aarch64-none-elf-` from ARM. `clang --target=aarch64-none-elf` also works. **Not**
`aarch64-linux-gnu-` for the link step — a KPM is `-r` partially linked, freestanding.
3. **Decide what the module does** before choosing an API: react to load/unload only (init/exit),
answer userspace control messages (ctl0), inline-hook a function (`hook_wrap`), or hook a syscall
(`fp_hook_syscalln` / `inline_hook_syscalln`). Read `references/api.md` for the one you need.
## Anatomy of a KPM
Every KPM is one or mo