Port of Linux to WebAssembly

4 min read Original article ↗
From: Joel Severin <joel.severin@icemanor.se>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Arnd Bergmann <arnd@arndb.de>
Subject: Port of Linux to WebAssembly
Date: Sat, 1 Nov 2025 14:19:59 +0000	[thread overview]
Message-ID: <618f3602-03aa-46a8-b2d4-3c9798c4cd2b@icemanor.se> (raw)
In-Reply-To: <f9b5a1db-681a-4ac2-888a-2b8228976e53@icemanor.se>


Hi,

During the past two years or so I have been slow-rolling an effort to 
port the Linux kernel to WebAssembly (Wasm). I'm now at the point where 
the kernel boots and I can run basic programs from a shell. As you will 
see if you play around with it for a bit, it's not very stable and will 
crash sooner or later, but I think this is a good first step.

Wasm is not necessarily only targeting the web, but that's how I have 
been developing this project. Since the current state is a web based 
demo, I'll drop a link below. This is Linux, booting in your browser 
tab, accelerated by Wasm. On a decent computer it should boot in <1s.
https://joelseverin.github.io/linux-wasm/

Unfortunately, my "hosting provider" (GitHub Pages) does not provide the 
right COOP/COEP HTTP headers for this to work (spectre mitigation), I 
guess I got what I (didn't) pay for. I found a workaround that often 
works, but the page takes longer to load and sometimes breaks, 
especially on some mobile devices. Reloading the page may help.

Now, this is a technology demo, it's to show what's possible. There are 
some things where what we have today makes this more painful than it has 
to be. The good news is that if there is a will to go forward with Linux 
and Wasm, at least I don't see why the current restrictions cannot be 
lifted. But, there would need to be a commitment from Linux and Wasm 
people, not to mention the whole ecosystem around it, to actually 
implement those changes. Some fundamentals of each platform would need 
to change for a smooth experience, especially so on the Wasm side.

If you find this interesting and you would like to join in on 
development, please let me know. I'm especially looking for competent 
people who can help me with atomics and locking in the kernel, but also 
scheduling. Or just general development in the kernel and/or the 
ecosystem around it, such as compiler or userland infrastructure.

Q: Why are you on kernel version 4.6, LLVM 17.0, ...?
A: This has been a side project of mine and I have been working on it on 
and off when I had time. I didn't want to have my kernel crash both 
because I did something wrong AND the rug being pulled under my feet 
because of new code coming in. Now that things boot, one of the top 
priorities is to rebase my branches to the latest stuff out there.

Q: What is it good for?
A: Compatibility with programs that want to run as web apps. Being able 
to link a kernel bug or new feature for anyone to test out. Sandboxing.

Q: But isn't it too slow to boot?
A: But then don't boot it on every page load. Pre-boot once and load a 
hibernated image after that. Just like any other asset on the web, the 
image can be compressed and cached by standard browser functionality.

BR,
Joel

           reply	other threads:[~2025-11-01 14:20 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <f9b5a1db-681a-4ac2-888a-2b8228976e53@icemanor.se>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=618f3602-03aa-46a8-b2d4-3c9798c4cd2b@icemanor.se \
    --to=joel.severin@icemanor.se \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).