A collection of in-progress experimental Linux kernel modules written for the Rust for Linux project
To run the out-of-tree modules here you'll need to run a custom kernel with the changes developed in mdaverde/linux which will continuously be rebasing off the upstream R4L fork.
This project uses just and zx for project-wide task management but installing a specific module should just require make.
The modules listed here have only been tested on an Ubuntu 21.04 x86_64 VM
- current - logs (
dmesg
) information about the task context in which the module is running in (e.g. the module insert process) - proc_iter - logs attributes of every
task_struct
(exceptswapper/0
) currently running - mem_layout - summarizes memory layout of the running kernel
- bsa - custom wrapper around a few of the kernel page allocation APIs and logs physical continuity
- kmalloc_box - custom alloc::Allocator (nightly) wrapped around
kmalloc()
andkfree()
used withBox::try_new_in
mod_template/
is meant to be a starting template for future modules
This repo is meant to be experimental and a showcase of potential LKM functionality with Rust. This project assumes you have all the same dependencies as R4L installed and can compile/install custom kernels.
$ just --list
Available recipes:
build module=DEFAULT_MODULE
clean module=DEFAULT_MODULE
create module
default
fmt
rust-analyzer
vars
$ just fmt # runs rustfmt */*.rs
$ just build # builds all modules
$ just build kmalloc_box # builds specific module
$ just create new_module # start new module
$ cd ./current
$ make KERNELDIR=/to/rust/kernel LLVM=1 modules
$ sudo insmod ./current.ko # install module
- procfs recreation
- module stacking
- use of
no_std
crates (throughcargo
?)