6 releases (3 breaking)
0.4.2 | Mar 6, 2023 |
---|---|
0.4.1 | Sep 19, 2022 |
0.4.0 | May 15, 2022 |
0.3.0 | Apr 22, 2022 |
0.1.0 | Apr 15, 2022 |
#507 in Unix APIs
64 downloads per month
94KB
683 lines
NixModule
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 nixmodule
Example below running it against a single kernel, running without arguments tests against every kernel in your nixmodule-config.toml
:
Pre-Built Kernels
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 |
Pre-Built Disk Images
ImgName | Link | SSH Key |
---|---|---|
Cornerstone | Image | Key |
Syzkaller Debian Buster | Image | Key |
Syzkaller Debian Stretch | Image | Key |
Using Other Kernels
Use the packing script
KERNEL=4.14.275 ./scripts/package.sh
This 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 = false
And increase the boot timeout with:
timeout = 600
Without kvm you'll likely need to increase the default the timeout.
Using Other Disk Images
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"
Dependencies
~11–25MB
~381K SLoC