Skip to content

Go runtime fails to initialize in WebVM: "failed to get system page size" #199

Description

@CompositeCoding

Description

A minimal Go "Hello World" program fails to run due to the Go runtime's inability to determine system page size during initialization.

I am following this tutorial https://cheerpx.io/docs/tutorials/full_os

Im building the Go binary locally and adding it to the docker container

Steps to Reproduce

  1. Create a minimal Go program:

    package main
    import "fmt"
    func main() {
        fmt.Println("Hello, World!")
    }
  2. Compile for Linux 386:

    GOOS=linux GOARCH=386 go build .
    
  3. Run the binary in WebVM:

    ./hello
    

Expected Behavior

Program should print "Hello, World!" and exit normally.

Actual Behavior

Program fails immediately with:

fatal error: failed to get system page size

runtime: panic before malloc heap initialized

runtime stack:
runtime.throw({0x8105613, 0x1e})
	/usr/local/go/src/runtime/panic.go:1094 +0x35 fp=0xc00ffd98 sp=0xc00ffd84 pc=0x
80bb2e5
runtime.mallocinit()
	/usr/local/go/src/runtime/malloc.go:389 +0x4c8 fp=0xc00ffdcc sp=0xc00ffd98 pc=0
x805d0b8
runtime.schedinit()
	/usr/local/go/src/runtime/proc.go:875 +0x111 fp=0xc00ffe10 sp=0xc00ffdcc pc=0x8
08b691
runtime.rt0_go()
	/usr/local/go/src/runtime/asm_386.s:243 +0x161 fp=0xc00ffe14 sp=0xc00ffe10 pc=0
x80becb1

Root Cause

The Go runtime fails during the earliest initialization phase because:

  • The runtime requires system page size information to initialize memory management
  • CheerpX's syscall implementation appears to not properly expose the page size information needed by the Go runtime
  • This happens before the memory allocator can be initialized, causing an immediate panic

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions