k23

Experimental WASM Microkernel Operating System

Stars
234

Bot releases are hidden (Show)

k23 - 0.0.3 Latest Release

Published by JonasKruckenberg about 1 month ago

It's time for another one! A bit more exciting this time!

What's Changed

KASLR

Over the last two weeks I finally implemented Kernel Address Space Layout Randomization (KASLR) in the loader. This required making a few changes to the way the kernel is built (i.e. fully position independent) and the loader.

Every memory region (kernel elf, stacks, heap, physical memory) is now mapped at randomized offsets.

This code can easily be reused to implement ASLR for user space as well. Next up would be function-grained ASLR, but that is much more complicated and I've been bashing my head against it without much success, so I'll leave that for later.

Streamlined build system

The build system got simplified massively to the point where dependencies on various native tools could be removed. It should also be more streamlined now!

Tests are run in CI

The test suite now gets on in CI on every commit; This way we can better track exactly how far along the WASM journey we are!

Other

  • Removed the kconfig configuration system and simplified repo setup
  • vendored the linked_list_allocator to reduce the dependency tree and have better integration
k23 - 0.0.2

Published by JonasKruckenberg about 2 months ago

k23 version 0.0.2

This is a smaller release, focusing mostly on an improved developer experience, better code organization and bug fixes.

What's Changed

Better Build Setup

k23 now has a much cleaner build setup using just, nushell and optionally nix for dependency management.

# Run in QEMU
just run configs/riscv64-qemu.toml

# Runs tests in QEMZ
just test configs/riscv64-qemu.toml

# And the basic check commands remain
just check configs/riscv64-qemu.toml
just clippy configs/riscv64-qemu.toml
just preflight

kconfig Build Configuration System

Compile-time configuration is now done through the kconfig system (not related to Linux's kconfig) which let's you declare
configuration symbols in Rust code and configure them in a unified .toml file:

#[kconfig_declare::symbol("kernel.stack-size-pages")]
pub const STACK_SIZE_PAGES: size = 32;

the above configuration symbol will read from the following .toml file

[kernel]
stack-size-pages = 128

Other

  • Fixed an issue mapping BSS segments larger than a page (#73)
  • Updated WASM spec test suite (#30)
  • Removed vendored gimli copy (#78)
  • Removed monolithic kstd crate in favor or multiple smaller ones (#90)
k23 - 0.0.1

Published by JonasKruckenberg 2 months ago

k23 version 0.0.1

This marks the first "release" of the kernel (more like marking a milestone), there are now downloadable artifacts yet but exciting work as been done:

Stack Unwinding

The kernel is now compiled with panic = "unwind" instead of panic = "abort" and comes with its own
custom stack unwinding runtime! This is a pretty huge change, as it requires lots of DWARF handling,
a custom personality routine and lots of poorly documented compiler internals.

catch_unwind & proper tests

k23 now has its now version of catch_unwind that allows code to intercept stack unwinding panics.
This is used by the test runner to allow the use of standard assertions like assert etc. and to recover from
panicking test cases in general.

WASM spec test suite

you can't manage what you can't measure.

We now run the full WASM spec test suite against the kernel, this helps to identify crashes, page faults and exactly which WASM features are missing! We haven't managed a full run through the test suite yet, but thats up next 😄

Panic backtraces

Kernel panics also now print a stack trace for easier debugging! The stack traces are unsymbolized for now meaning only
raw pc, sp and symbol addresses are printed.

LazyLock and OnceLock in kstd

This change moves a bit of code around and adds a LazyLock primitive to provide on-demand lazy one-time initialization.