Remix.run Logo
pantalaimon 5 days ago

This produces

        attempted to munmap
        ------------[ cut here ]------------
        WARNING: CPU: 3 PID: 36 at kernel/exit.c:812 0x00000000
        CPU: 3 PID: 36 Comm: sh Not tainted 6.1.132 #
        Stack:
            at vmlinux.o.__warn (https://linux.tombl.dev/dist/vmlinux-NLTKI6YG.wasm:wasm-function[278]:0x17655)
            at vmlinux.o.warn_slowpath_fmt (https://linux.tombl.dev/dist/vmlinux-NLTKI6YG.wasm:wasm-function[279]:0x1772b)
            at vmlinux.o.do_exit (https://linux.tombl.dev/dist/vmlinux-NLTKI6YG.wasm:wasm-function[329]:0x1985e)
            at vmlinux.o.task_entry_inner (https://linux.tombl.dev/dist/vmlinux-NLTKI6YG.wasm:wasm-function[154]:0x12249)
            at vmlinux.o.task_entry (https://linux.tombl.dev/dist/vmlinux-NLTKI6YG.wasm:wasm-function[153]:0x12155)
            at self.onmessage (https://linux.tombl.dev/dist/worker-MHWHWELT.js:151:53)
        ---[ end trace 0000000000000000 ]---
on any command
tombl 5 days ago | parent [-]

yep, that's to be expected, this is a very wip demo. I'm implementing exec() support now, so currently only shell builtins work.

jerf 4 days ago | parent | next [-]

"I'm implementing exec() support now"

Bah. Details, details dismissive hand wave.

It's just minimalism, right? I hear it's all the rage.

tombl 4 days ago | parent | next [-]

I'm effectively lying to the kernel about the environment it's executing in, and trying to convince it that it's running on the kind of hardware it expects, when in reality it's running inside a very different environment.

Since I map guest threads 1:1 to host threads in JS, and architecture-specific code manages the loading/unloading of programs, the exec syscall is exercising these lies in a way that they're not currently equipped to handle.

What I'm currently doing is improving those lies to the point where exec stops noticing they're lies and just starts functioning as expected.

remram 4 days ago | parent | prev | next [-]

Leave it as an exercise to the reader.

all2 4 days ago | parent [-]

I had to implement exec() on Unix V6 for my OS course at uni.

ebiester 4 days ago | parent | prev [-]

I mean, "demos that shouldn't be shared" from the root comment implies that it isn't done, right?

7bit 4 days ago | parent | prev [-]

I got that with echo * which you suggested to use :)

I opened that on my Android Phone and half expected it not to boot at all. But it does. I have no idea about the state of WASM n stuff, but apparently, it's much more eadvanced than I anticipated. Mind blown.