News

Introducing Wasmjit: A kernel mode WebAssembly runtime for Linux

2 min read

Written in C90, Wasmjit is a small embeddable WebAssembly runtime. It is portable to most environments but it primarily targets a Linux kernel module that can host Emscripten-generated WebAssembly modules.

What are the benefits of Wasmjit?

  • Improved performance: Using Wasmjit you will be able to run WebAssembly modules in kernel-space (ring 0). This will provide access to system calls as normal function calls, which eliminates the user-kernel transition overhead. This also avoids the scheduling overheads from swapping page tables. This provides a boost in performance for syscall-bound programs like web servers or FUSE file systems.
  • No need to run an entire browser: It also comes with a host environment for running in user-space on POSIX systems. This will allow running WebAssembly modules without having to run an entire browser.

What tools do you need to get started?

The following are the tools you require to get started with Wasmjit:

  • A standard POSIX C development environment with cc and make
  • Emscripten SDK
  • Optionally, you can install kernel headers on Linux, the linux-headers-amd64 package on Debian, kernel-devel on Fedora

What’s in the future?

Wasmjit currently supports x86_64 and can run a subset of Emscripten-generated WebAssembly on Linux, macOS, and within the Linux kernel as a kernel module. In coming releases we will see more implementations and improvements along the following lines:

  • Enough Emscripten host-bindings to run nginx.wasm
  • Introduction of an interpreter
  • Rust-runtime for Rust-generated wasm files
  • Go-runtime for Go-generated wasm files
  • Optimized x86_64 JIT
  • arm64 JIT
  • macOS kernel module

What to consider when using this runtime?

Wasmjit uses vmalloc(), a function for allocating a contiguous memory region in the virtual address space, for code and data section allocations. This prevents those pages from ever being swapped to disk resulting in indiscriminate access to the /dev/wasm device. This can make a system vulnerable to denial-of-service attacks.

To mitigate this risk, in future, a system-wide limit on the amount of memory used by the /dev/wasm device will be provided.

To get started with Wasmjit, check out its GitHub repository.

Read Next

Why is everyone going crazy over WebAssembly?

Unity Benchmark report approves WebAssembly load times and performance in popular web browsers

Golang 1.11 is here with modules and experimental WebAssembly port among other updates

Bhagyashree R

Share
Published by
Bhagyashree R

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago