increasingly powerful › Increasingly powerful execution environments › Used for games, 3D rendering, video, and LLMs 2. Can any program run? › No, it’s very difficult. » To ensure security and portability » Direct access to OS or device resources is restricted The Browser as a Computing Platform web-llm
directly in the browser › e.g., postgres-wasm, ffmpeg.wasm, Libreoffice in the browser What if we could run any native app in the browser? Native–browser convergence combines native performance with web-level portability and security.
emulator and x86-to-wasm JIT, in the browser › repo : https://github.com/copy/v86 › can run several 32 bit x86 Oses (Linux, FreeBSD, etc.) in the browser › performance that is tens of times slower 2. container2wasm : Container to WASM converter › repo : https://github.com/container2wasm/container2wasm › can run 64bit Linux and Linux containers in the browser › performance that is tens of times slower Existing Projects Porting a CPU emulator results in significant performance degradation.
https://github.com/lifting-bits/remill • elfconv : AOT binary translator of Linux apps → WebAssembly › repo : https://github.com/yomaytk/elfconv › Linux/ELF/AArch64 → Wasm is supported now elfconv Linux app LLVM bitcode Architecture overview Runtime (C++) memory management system calls API, etc. with
must have been implemented › CPU-emulator–based projects can use the Linux kernel as-is. › Most difficult parts of elfconv • Many system calls are sufficient to call the library function of emscripten › e.g., openat, read, write, unlinkat, truncate, ... • Some system calls implementation is not trivial. › e.g., fork, execve, socket, ... Linux system calls emulation
must have been implemented › CPU-emulator–based projects can use the Linux kernel as-is. › Most difficult parts of elfconv • Many system calls are sufficient to call the library function of emscripten › e.g., openat, read, write, unlinkat, truncate, ... • Some system calls implementation is not trivial. › e.g., fork, execve, socket, ... Linux system calls emulation
(appA.wasm + appA.js) Worker pool ... Browser Linux Apps appA appB appA.js appB.wasm appB.js File System /usr/bin/appA /usr/bin/appB ... System calls emulation process management js-kernel
(appA.wasm + appA.js) Worker pool ... Browser Linux Apps appA appB appA.js appB.wasm appB.js File System /usr/bin/appA /usr/bin/appB ... System calls emulation process management js-kernel worker A2 (appA.wasm + appA.js) process state fork
additional Linux syscall emulation › convert the Linux shared objects (.so) » only statically linked ELF binary is supported now › additional machine code conversion (especially x86-64) 1. Porting more tools › enhance python environment, porting CRuby, ... › Do you have any ideas? 😀 Future Work Any issues or PRs are welcome! Repo: https://github.com/yomaytk/elfconv