- C 76.4%
- Nix 9.9%
- Makefile 7.5%
- Shell 3.6%
- Lua 2.6%
| hello-wired | ||
| pwnmod | ||
| selftest | ||
| wired | ||
| wired-banner | ||
| wired-nvim | ||
| .gitignore | ||
| flake.nix | ||
| README.md | ||
modules
out-of-tree linux kernel modules i use personally. built against a mainline-rc kernel (linuxPackages_testing) on tuna, my strix halo box. one dir per module, each nix-packaged.
- wired: kprobe execve tracer, records drain at /proc/wired
- hello-wired: chardev + ioctl scaffold, copy the dir to start a new one
- selftest: reads cr0.wp / cr4.{smep,smap,umip,fsgsbase,cet,la57} / efer.nxe, kernel .text w^x + direct-map nx via a guarded page-table walk, kaslr/kptr/ dmesg state, cpuid mitigation bits. table at /sys/kernel/wired-selftest/{results,summary} and the same over debugfs
- wired-nvim: nvim writes /dev/wired-nvim, waybar reads /proc/wired-nvim
- wired-banner: lain boot banner in dmesg
- pwnmod: vm-only vulnerable chardev for kernel-pwn. do not load on real hw
build
nix build .#wired # or any module name
nix flake check # every module except pwnmod
or per dir against the running kernel:
cd wired && make && sudo insmod wired.ko && sudo cat /proc/wired
selftest: sudo modprobe selftest then cat the sysfs/debugfs nodes above.
use from nixfiles
inputs.kmods.url = "git+https://git.collar.sh/quaver/modules.git";
boot.extraModulePackages =
builtins.attrValues (inputs.kmods.lib.packagesFor config.boot.kernelPackages);
pwnmod is not in packagesFor. it #errors unless built with -DPWNMOD_I_AM_IN_A_VM (make VMLAB=1) and its default.nix throws unless vulnModule=true. keep it off any real host.
style
kernel tree style, not my userspace style: tabs, 80 col, snake_case. every module opens with a header block stating purpose + the gotcha it navigates (opaque ftrace_regs, unexported kallsyms_lookup_name, the syscall-wrapper indirection). comments say why, not how. bounds-check every copy_from_user, cap every user-controlled length, all input is hostile.