[<prev] [next>] [day] [month] [year] [list]
Message-ID: <618f3602-03aa-46a8-b2d4-3c9798c4cd2b@icemanor.se>
Date: Sat, 1 Nov 2025 14:19:59 +0000
From: Joel Severin <joel.severin@...manor.se>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>, Andrew Morton
<akpm@...ux-foundation.org>, Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Arnd Bergmann <arnd@...db.de>
Subject: Port of Linux to WebAssembly
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
Powered by blists - more mailing lists