Simple qemu wrapper to automatically test out-of-tree linux kernel modules across multiple kernel versions. The provided images all have KASAN to aide your development.
cargo install nixmoduleExample below running it against a single kernel, running without arguments tests against every kernel in your nixmodule-config.toml:
Check nixmodule-config.toml for an example configuration using all of these images.
| Version | BzImage | Headers | LTS? |
|---|---|---|---|
| 5.17.2 | bZimage | Headers | |
| 5.15.33 | bZimage | Headers | Yes |
| 5.10.110 | bZimage | Headers | Yes |
| 5.8.9 | bZimage | Headers | |
| 5.4.188 | bZimage | Headers | Yes |
| 4.19.237 | bZimage | Headers | Yes |
| 4.14.275 | bZimage | Headers | Yes |
| 4.9.309 | bZimage | Headers | Yes |
| 4.4.302 | bZimage | Headers | Yes |
| ImgName | Link | SSH Key |
|---|---|---|
| Cornerstone | Image | Key |
| Syzkaller Debian Buster | Image | Key |
| Syzkaller Debian Stretch | Image | Key |
Use the packing script
KERNEL=4.14.275 ./scripts/package.shThis builds the required bzImage and an archive linux-$VERSION-headers.tar.gz containing the headers/module info required to build an out-of-tree kernel module.
Then add the new kernel to your configuration file nixmodule-config.toml:
[[kernels]]
version = "4.19.237"
url_base = "https://files.sboc.dev"
headers = "linux-headers/linux-4.19.237-headers.tar.gz"
kernel = "linux-kernels/bzImage-linux-4.19.237"
runner = "qemu-system-x86_64"
[kernels.disk]
name = "stretch"
url_base = "https://files.sboc.dev"
path = "images/stretch/stretch.img"
sshkey = "images/stretch/stretch.id_rsa"
boot = "/dev/sda"You can optionally disable kvm with:
kvm = falseAnd increase the boot timeout with:
timeout = 600Without kvm you'll likely need to increase the default the timeout.
Fill out the [kernels.disk] entry for the kernel you'd like to use the new disk with:
[kernels.disk]
name = "stretch"
url_base = "https://files.sboc.dev"
path = "images/stretch/stretch.img"
sshkey = "images/stretch/stretch.id_rsa"
boot = "/dev/sda"Boot should contain the partition to boot from. This is passed to qemu to append as kernel arguments:
-append "console=ttyS0 root=$BOOT earlyprintk=serial net.ifnames=0 nokaslr"
