Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/landhb/nixmodule
Simple qemu wrapper to automatically test out-of-tree linux kernel modules against multiple kernel versions.
https://github.com/landhb/nixmodule
framework kasan kernel linux linux-kernel lkm out-of-tree qemu qemu-kvm rust testing
Last synced: about 1 month ago
JSON representation
Simple qemu wrapper to automatically test out-of-tree linux kernel modules against multiple kernel versions.
- Host: GitHub
- URL: https://github.com/landhb/nixmodule
- Owner: landhb
- Created: 2022-04-09T21:09:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-14T22:26:08.000Z (about 1 year ago)
- Last Synced: 2024-09-29T15:45:26.767Z (about 2 months ago)
- Topics: framework, kasan, kernel, linux, linux-kernel, lkm, out-of-tree, qemu, qemu-kvm, rust, testing
- Language: Rust
- Homepage:
- Size: 139 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NixModule [![cargo-badge][]][cargo-link]
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.
```sh
cargo install nixmodule
```- [Pre-Built Kernels](#pre-built-kernels)
- [Pre-Built Disk Images](#pre-built-disks)
- [Using Other Kernels](#using-other-kernels)
- [Using Other Disk Images](#using-other-disks)Example below running it against a single kernel, running without arguments tests against every kernel in your [`nixmodule-config.toml`](example/nixmodule-config.toml):
Check [`nixmodule-config.toml`](example/nixmodule-config.toml) for an example configuration using all of these images.
| Version | BzImage | Headers | LTS? |
| :---: | :---: | :---: | :---: |
| 5.17.2 | [bZimage](https://files.sboc.dev/linux-kernels/bzImage-linux-5.17.2) | [Headers](https://files.sboc.dev/linux-headers/linux-5.17.2-headers.tar.gz) | |
| 5.15.33 | [bZimage](https://files.sboc.dev/linux-kernels/bzImage-linux-5.15.33) | [Headers](https://files.sboc.dev/linux-headers/linux-5.15.33-headers.tar.gz) | Yes |
| 5.10.110 | [bZimage](https://files.sboc.dev/linux-kernels/bzImage-linux-5.10.110) | [Headers](https://files.sboc.dev/linux-headers/linux-5.10.110-headers.tar.gz) | Yes |
| 5.8.9 | [bZimage](https://files.sboc.dev/linux-kernels/bzImage-linux-5.8.9) | [Headers](https://files.sboc.dev/linux-headers/linux-5.8.9-headers.tar.gz) | |
| 5.4.188 | [bZimage](https://files.sboc.dev/linux-kernels/bzImage-linux-5.4.188)| [Headers](https://files.sboc.dev/linux-headers/linux-5.4.188-headers.tar.gz) | Yes |
| 4.19.237| [bZimage](https://files.sboc.dev/linux-kernels/bzImage-linux-4.19.237) | [Headers](https://files.sboc.dev/linux-headers/linux-4.19.237-headers.tar.gz) | Yes |
| 4.14.275| [bZimage](https://files.sboc.dev/linux-kernels/bzImage-linux-4.14.275) | [Headers](https://files.sboc.dev/linux-headers/linux-4.14.275-headers.tar.gz) | Yes |
| 4.9.309 | [bZimage](https://files.sboc.dev/linux-kernels/bzImage-linux-4.9.309) | [Headers](https://files.sboc.dev/linux-headers/linux-4.4.309-headers.tar.gz) | Yes |
| 4.4.302 | [bZimage](https://files.sboc.dev/linux-kernels/bzImage-linux-4.4.302) | [Headers](https://files.sboc.dev/linux-headers/linux-4.4.302-headers.tar.gz) | Yes || ImgName | Link | SSH Key |
| :---: | :---: | :---: |
| Cornerstone | [Image](https://files.sboc.dev/images/cornerstone/cornerstone.img) | [Key](https://files.sboc.dev/images/cornerstone/cornerstone.id_ecdsa) |
| Syzkaller Debian Buster | [Image](https://files.sboc.dev/images/syzkaller-buster/buster.img) | [Key](https://files.sboc.dev/images/syzkaller-buster/buster.id_rsa) |
| Syzkaller Debian Stretch | [Image](https://files.sboc.dev/images/syzkaller-stretch/stretch.img) | [Key](https://files.sboc.dev/images/syzkaller-stretch/stretch.id_rsa) |Use the packing script
```sh
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`:
```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:
```toml
kvm = false
```And increase the boot timeout with:
```toml
timeout = 600
```Without 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:
```toml
[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"
```[//]: # (badges/links)
[cargo-badge]: https://img.shields.io/crates/v/nixmodule.svg?label=crates.io
[cargo-link]: https://crates.io/crates/nixmodule