Skip to content

runtime: panic before malloc heap initialized on plan9/amd64 #74006

Closed

Description

@sctaw

Go version

go version go1.24.3 plan9/386

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='0'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GO386='sse2'
GOARCH='386'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/usr/glenda/lib/cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/usr/glenda/lib/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m32 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build318083811=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='386'
GOHOSTOS='plan9'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/usr/glenda/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='plan9'
GOPATH='/usr/glenda/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/n/9p-go/386-1.24.3'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/usr/glenda/lib/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/n/9p-go/386-1.24.3/pkg/tool/plan9_386'
GOVCS=''
GOVERSION='go1.24.3'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

I compiled a simple Hello World from an plan9/386 host for a plan9/amd64 (nightly 9front/amd64) target but got an strange error.
I tried the same from a linux/amd64 host, it was the same.

package main

import "fmt"

func main(){
	fmt.Println("Hello, World!")
}
GOOS=plan9 GOARCH=amd64 go build -o hello hello.go

What did you see happen?

I got this error

M structure uses sizeclass 1792/0x700 bytes; incompatible with mutex flag mask 0x3ff
fatal error: runtime.m memory alignment too small for spinbit mutex
runtime: panic before malloc heap initialized

runtime stack:
runtime.throw({0x2afac1?, 0x0?})
	/usr/lib/go/src/runtime/panic.go:1101 +0x49 fp=0x7fffffffeec8 sp=0x7fffffffee98 pc=0x262309
runtime.lockVerifyMSize()
	/usr/lib/go/src/runtime/lock_spinbit.go:97 +0xc5 fp=0x7fffffffeef0 sp=0x7fffffffeec8 pc=0x20fa85
runtime.schedinit()
	/usr/lib/go/src/runtime/proc.go:818 +0x34 fp=0x7fffffffef50 sp=0x7fffffffeef0 pc=0x2393d4
runtime.rt0_go()
	/usr/lib/go/src/runtime/asm_amd64.s:349 +0x128 fp=0x7fffffffef58 sp=0x7fffffffef50 pc=0x2665c8

What did you expect to see?

Hello, World!

Activity

  1. changed the title [-]A simple Hello World fails for OS-Plan9/amd64 kernel[/-] [+]cmd/compile: compilation fails on plan9/amd64[/+] on Jun 5, 2025
  2. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Jun 5, 2025
  3. cagedmantis commented on Jun 5, 2025

    @cagedmantis
    Contributor

    @golang/plan9

  4. changed the title [-]cmd/compile: compilation fails on plan9/amd64[/-] [+]runtime: panic before malloc heap initialized on plan9/amd64[/+] on Jun 5, 2025
  5. cuonglm commented on Jun 5, 2025

    @cuonglm
    Member

    cc @golang/runtime

  6. sctaw commented on Jun 5, 2025

    @sctaw
    Author

    the problem didn't exist in go1.23.9

  7. cuonglm commented on Jun 5, 2025

    @cuonglm
    Member
  8. cherrymui commented on Jun 5, 2025

    @cherrymui
    Member

    M structure uses sizeclass 1792/0x700 bytes; incompatible with mutex flag mask 0x3ff
    fatal error: runtime.m memory alignment too small for spinbit mutex

    This particular error message is from http://go.dev/cl/620435 . It suggests that the size of runtime.m type has an unexpected size. The padding code has been rewritten in https://go.dev/cl/654595 , which is included at tip and will be in Go 1.25, but not in Go 1.24. Could you try if this issue is resolved at tip? Thanks.

    (The plan9/amd64 builder doesn't seem working, so we cannot try it ourselves.)

  9. added
    WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.
    on Jun 5, 2025
  10. sctaw commented on Jun 5, 2025

    @sctaw
    Author

    building tip, brb.

  11. rhysh commented on Jun 5, 2025

    @rhysh
    Contributor

    With Go 1.24, you can revert to the previous runtime.mutex implementation (which doesn't require special alignment for the M structure) by building with GOEXPERIMENT=nospinbitmutex. That should fix the fatal error: runtime.m memory alignment too small for spinbit mutex problem.

    Yes, looks like the plan9/amd64 builder is/was offline.

  12. sctaw commented on Jun 5, 2025

    @sctaw
    Author

    The issue was resolved in tip and nightly 9front. an older qemu machine still gave a sys:suicide error. maybe updating builders to nightly will bring them back.

    go version go1.25-devel_4d1c255 Thu Jun 5 11:44:48 2025 -0700 linux/amd64
    
  13. prattmic commented on Jun 5, 2025

    @prattmic
    Member

    I believe that the floating point issue is related to a kernel fix that @rsc sent for plan9 (see https://tailscale.com/blog/plan9-port#sse). That allowed us to drop some workarounds in Go (https://go.dev/cl/655875).

    @rsc @golang/plan9 does https://go.dev/wiki/Plan9 need an update on minimum requirements?

  14. locked and limited conversation to collaborators on Jun 6, 2026
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

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions