Skip to content
BashfulHippoPublic

About

A capability-based microkernel with WebAssembly sandboxing for bare-metal environments

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

JerichoOS πŸ›‘οΈ

Build Status License Rust Architecture

A capability-based microkernel with WebAssembly sandboxing

Features β€’ Quick Start β€’ Architecture β€’ Benchmarks β€’ Docs


Overview

JerichoOS is a research microkernel built in Rust (no_std) exploring capability-based security and WebAssembly isolation in bare-metal environments. It runs untrusted WASM modules with fine-grained access control, demonstrating how modern sandboxing can work at the kernel level.

Why JerichoOS?

  • Capability Security: Fine-grained access control for kernel services
  • Memory Safe: Rust with unsafe contained to narrow, audited boundaries
  • WASM Runtime: Run untrusted code safely using wasmi interpreter
  • Dual Architecture: Unified codebase for x86-64 and ARM64
  • Research-Focused: Designed for learning and experimentation

Features

Security

  • Capability-based IPC
  • WASM sandbox isolation
  • Memory-safe kernel core
  • Protected syscall interface

Runtime

  • Preemptive scheduler
  • Inter-process messaging
  • Host function bridging
  • Stack overflow protection

Portability

  • x86-64 support (QEMU)
  • ARM64/AArch64 (Cortex-A57)
  • Exception level transitions
  • Platform abstraction layer

Current Status

Component x86-64 ARM64 Notes
Kernel Boot βœ… βœ… QEMU virt machine
WASM Runtime βœ… βœ… wasmi 0.31
Demo Suite βœ… βœ… 5 demos passing
Capability System βœ… βœ… IPC enforcement working
Scheduler βœ… βœ… Preemptive multitasking
CI/CD βœ… βœ… GitHub Actions

Latest Verification: October 19, 2026 ... both demo suites pass on QEMU 8.2.2


Quick Start

Prerequisites

# Install Rust nightly toolchain
rustup toolchain install nightly
rustup component add rust-src llvm-tools-preview

# Install QEMU
# Ubuntu/Debian:
sudo apt install qemu-system-x86 qemu-system-arm

# macOS:
brew install qemu

Run Demos

x86-64

./demo_x86.sh

ARM64

./demo_arm64.sh

Expected Output:

βœ“ Demo 1: Pure Computation        PASS
βœ“ Demo 2: Host Function Calls     PASS
βœ“ Demo 3: Syscall & Capability    PASS
βœ“ Demo 4: MQTT Broker Pub/Sub     PASS
βœ“ Demo 5: Security & Isolation    PASS

RESULT: PASS

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      WASM Modules (Sandboxed)              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ mqtt.wasm β”‚  β”‚ app.wasm β”‚  β”‚ test.wasmβ”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  wasmi Interpreter β”‚
    β”‚  (Host Bridge)     β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  Capability Checker  β”‚
    β”‚  (Access Control)    β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  Syscall Layer       β”‚
    β”‚  IPC β€’ Print β€’ MQTT  β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  Scheduler Core      β”‚
    β”‚  Memory β€’ Interrupts β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  Architecture Layer β”‚
    β”‚  x86-64 β”‚ ARM64     β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Components

  • WASM Runtime: Sandboxed execution environment with wasmi interpreter
  • Capability System: Token-based access control for kernel resources
  • IPC Layer: Message passing between isolated modules
  • Scheduler: Cooperative/preemptive task switching
  • Architecture Abstraction: Shared kernel logic across x86-64 and ARM64

Demo Suite

The kernel includes five demonstration programs showcasing core features:

Demo Description Key Features
1. Pure Computation Arithmetic operations in WASM Basic execution, stack operations
2. Host Functions Calling kernel services Host bridge, print syscalls
3. Syscall & Capability Protected resource access Capability checks, syscall dispatcher
4. MQTT Pub/Sub Message broker simulation IPC, multi-module coordination
5. Security Isolation enforcement Sandbox escapes, unauthorized IPC

Benchmarks

Measured in QEMU TCG with a calibrated clock (TSC vs PIT on x86-64, CNTFRQ on ARM64):

x86-64 ARM64
Capability syscall (derive/revoke) ~210-245 ns ~250-290 ns
IPC send + receive, 64 B ~1.1-1.2 Β΅s ~1.4 Β΅s
Context switch ~260-370 ns ~370-590 ns
Boot (kernel entry to ready) ~16-19 ms ~1 ms

⚠️ Note: QEMU numbers are relative indicators for comparing kernel changes on one host, not hardware performance.

See BENCHMARKS.md for exactly what each line times.


Repository Structure

jerichoos/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.rs, main_aarch64.rs   # thin entry points, one per architecture
β”‚   β”œβ”€β”€ kernel.rs         # shared boot sequence, heap, panic handler
β”‚   β”œβ”€β”€ arch/x86_64/      # GDT/TSS, IDT + PIC + PIT, paging + heap, TSC, context switch
β”‚   β”œβ”€β”€ arch/aarch64/     # boot.S, vectors, GIC, timer, MMU, context switch
β”‚   β”œβ”€β”€ scheduler.rs      # round-robin, cooperative + timer preemption
β”‚   β”œβ”€β”€ sync.rs           # irq-safe spinlock
β”‚   β”œβ”€β”€ capability.rs     # rights, capabilities, CSpace
β”‚   β”œβ”€β”€ ipc.rs            # capability-checked endpoints, blocking receive, cap transfer
β”‚   β”œβ”€β”€ syscall.rs        # 5-call capability syscall dispatcher
β”‚   β”œβ”€β”€ wasm_runtime.rs   # wasmi + the 7 host functions
β”‚   β”œβ”€β”€ benchmark.rs      # measured benchmarks (see BENCHMARKS.md)
β”‚   └── demos/            # 5 WASM demos + the kernel tasks
β”œβ”€β”€ demos/wasm/           # WASM modules (.wat sources + vendored .wasm)
β”œβ”€β”€ .github/workflows/    # CI pipelines
β”œβ”€β”€ demo_x86.sh, demo_arm64.sh, bench_x86.sh, bench_arm64.sh
└── docs/                 # project status and known limitations

Development

Build from Source

# x86-64 kernel (two passes: build.rs creates boot images once the kernel binary exists)
cargo build --bin jericho_os --release --features bootloader-build
touch build.rs
cargo build --bin jericho_os --release --features bootloader-build

# ARM64 kernel
./build_arm64.sh

Quality Gates

Before committing, ensure all checks pass:

# Build verification
cargo check --bin jericho_os --release
cargo check --bin jericho_os_arm64 --release \
    --target aarch64-jericho.json \
    -Z build-std=core,compiler_builtins,alloc

# Run test suites
./demo_x86.sh && ./demo_arm64.sh

Known Limitations

  • No user mode: syscalls are function calls from kernel tasks or the WASM bridge; WASM linear memory is the isolation boundary
  • Revocation: removes one capability slot; there is no derivation tree, so derived copies survive
  • Memory Management: x86-64 extends the bootloader's tables for the heap; ARM64 is an identity map with 2 MB blocks
  • MQTT Demos: broker and publisher are vendored prebuilt .wasm example modules; the subscriber is built from .wat in this repo (see demos/wasm/README.md)

See PROJECT_STATUS.md for the full list of limitations.


Documentation

  • Project Status β€” Current capabilities and known issues
  • Benchmarks β€” What each benchmark measures and its limits

Contributing

JerichoOS is a research/learning project. Contributions are welcome for:

  • Bug fixes and stability improvements
  • Documentation enhancements
  • Performance optimizations
  • Architecture-specific improvements

Please ensure all quality gates pass before submitting PRs.


License

MIT License - See LICENSE for details.


Acknowledgments

Built with:

  • Rust β€” Memory-safe systems programming
  • wasmi β€” WebAssembly interpreter
  • QEMU β€” Hardware emulation

Special thanks to the Rust embedded and OS dev communities.


⬆ Back to Top

Made with πŸ¦€ by BashfulHippo

About

A capability-based microkernel with WebAssembly sandboxing for bare-metal environments

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages