Skip to content

cmd/compile: unexpected fault address while compiling #77605

@abhinav

Description

@abhinav

Go version

go1.26 linux/arm64

Output of go env in your module/workspace:

Information not available, unfortunately.
However:

- Host was a Linux AMD64 machine
- It was running `docker build --platform=linux/arm64` with base image `golang:1.26.0-alpine`
- The program is pure Go, compiled with `CGO_ENABLED=0`:

    RUN --mount=type=ssh CGO_ENABLED=0 go build -o /go/bin/myprogram

What did you do?

We ran two different docker builds where the Dockerfile attempts to compile a pure Go program using Go 1.26.
Relevant parts:

The following command were run on a Linux AMD64 host.

docker build \
	--ssh default \
	--platform=linux/arm64 \
	-f path/to/foo/Dockerfile \
	.

docker build \
	--ssh default \
	--platform=linux/arm64,linux/amd64 \
	-f path/to/bar/Dockerfile \
	.

Both Dockerfiles contained:

FROM golang:1.26.0-alpine AS build

RUN apk add --no-cache --upgrade git openssh-client && \
    mkdir -p -m 0700 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts && \
    git config --global url."git@github.com:".insteadOf "https://github.com/"
ENV GOPRIVATE=github.com/myorg/*

RUN --mount=type=ssh CGO_ENABLED=0 GOOS=linux go build \
  -o /go/bin/foo github.com/import/path/of/foo

# ...

What did you see happen?

Compilation failed for both Dockerfiles with:

unexpected fault address 0xffffffffff895000
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0xffffffffff895000 pc=0x282458]

(Address is indeed '0xffffffffff895000' for both.)

Additional details:

  • The cache was entirely empty.
  • Both builds failed on the same program (the two Dockerfiles have a shared program)
  • The program they failed on is 329 lines long, with only 169 lines of code.
  • This was all inside a Go workspace.

The full stack traces are rather large.
Here are the first few lines of both:

unexpected fault address 0xffffffffff895000
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0xffffffffff895000 pc=0x282458]

goroutine 14 gp=0x5b3b50845a0 m=8 mp=0x5b3b5080008 [running]:
runtime.throw({0x6f0394?, 0x75ff90?})
	runtime/panic.go:1229 +0x38 fp=0x5b3b54d9c60 sp=0x5b3b54d9c30 pc=0x93918
runtime.sigpanic()
	runtime/signal_unix.go:945 +0x21c fp=0x5b3b54d9cc0 sp=0x5b3b54d9c60 pc=0x95e3c
net.(*sysDialer).dialTCP(0xca6151?, {0x75ff90?, 0x5b3b4bf6a50?}, 0x266780?, 0x5b3b54d9d58?)
	net/tcpsock_posix.go:66 +0x78 fp=0x5b3b54d9d10 sp=0x5b3b54d9cd0 pc=0x282458
net.(*sysDialer).dialSingle(0x5b3b5c18000, {0x75ff90, 0x5b3b4bf6a50}, {0x75beb8, 0x5b3b551d770})
	net/dial.go:791 +0x2c4 fp=0x5b3b54d9de0 sp=0x5b3b54d9d10 pc=0x268e64
net.(*sysDialer).dialSerial(0x5b3b5c18000, {0x75ff90, 0x5b3b4bf6a50}, {0x5b3b58c00c0?, 0x1, 0x262ec8?})
	net/dial.go:756 +0x1a0 fp=0x5b3b54d9ef0 sp=0x5b3b54d9de0 pc=0x2688a0
net.(*sysDialer).dialParallel.func1({0x75ff90?, 0x5b3b4bf6a50?}, 0x1)
	net/dial.go:676 +0x64 fp=0x5b3b54d9fa0 sp=0x5b3b54d9ef0 pc=0x268614
net.(*sysDialer).dialParallel.gowrap2()
	net/dial.go:691 +0x2c fp=0x5b3b54d9fd0 sp=0x5b3b54d9fa0 pc=0x26858c
runtime.goexit({})
	runtime/asm_arm64.s:1447 +0x4 fp=0x5b3b54d9fd0 sp=0x5b3b54d9fd0 pc=0x9b294
created by net.(*sysDialer).dialParallel in goroutine 123
	net/dial.go:691 +0x1bc
unexpected fault address 0xffffffffff895000
unexpected fault address 0xffffffffff895000
unexpected fault address 0xffffffffff895000
fatal error: unexpected fault address 0x56e5
fatal error: fatal error: fatal error: unexpected fault address 0xffffffffff895000
fatal error: unexpected fault address 0xffffffffff895000
fatal error: fatal error: sync: inconsistent mutex statefault
fault

fault
fault
unexpected fault address 0xffffffffff895000
fatal error: fault
fault
fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0xffffffffff895000 pc=0x152a28]

goroutine 103 gp=0x8a852205860 m=14 mp=0x8a852081008 [running]:
runtime.throw({0x6f0394?, 0x19?})
	runtime/panic.go:1229 +0x38 fp=0x8a8525fcc70 sp=0x8a8525fcc40 pc=0x93918
runtime.sigpanic()
	runtime/signal_unix.go:945 +0x21c fp=0x8a8525fccd0 sp=0x8a8525fcc70 pc=0x95e3c
go/scanner.ErrorList.Less(...)
	go/scanner/errors.go:50
go/scanner.(*ErrorList).Less(0x8a8525fcd78?, 0x33d30?, 0xca7820?)
	<autogenerated>:1 +0x28 fp=0x8a8525fcd40 sp=0x8a8525fcce0 pc=0x152a28
sort.order2(...)
	sort/zsortinterface.go:299
sort.median({0x75ed90, 0x8a8522ca018}, 0x1b9c995d1b9a4bd7, 0x1b9c995d1b9a4bd8, 0x1b9c995d1b9a4bd9, 0x8a8525fcdc8)
	sort/zsortinterface.go:308 +0x40 fp=0x8a8525fcd80 sp=0x8a8525fcd40 pc=0x14f0c0
sort.medianAdjacent(...)
	sort/zsortinterface.go:316
sort.choosePivot({0x75ed90, 0x8a8522ca018}, 0x5500a15e00?, 0x18?)
	sort/zsortinterface.go:279 +0x9c fp=0x8a8525fce10 sp=0x8a8525fcd80 pc=0x14efac
sort.pdqsort({0x75ed90, 0x8a8522ca018}, 0x18?, 0x609140?, 0x8a852c22001?)
	sort/zsortinterface.go:89 +0x94 fp=0x8a8525fcea0 sp=0x8a8525fce10 pc=0x14e634
sort.Sort({0x75ed90, 0x8a8522ca018})
	sort/sort.go:56 +0x60 fp=0x8a8525fcee0 sp=0x8a8525fcea0 pc=0x14d260
go/scanner.ErrorList.Sort(...)
	go/scanner/errors.go:71
go/parser.ParseFile.func1()
	go/parser/interface.go:125 +0x2a4 fp=0x8a8525fcfe0 sp=0x8a8525fcee0 pc=0x1980c4
go/parser.ParseFile(0x8a8524e60c0, {0x8a8525d5240, 0x39}, {0x5f5cc0?, 0x8a8522ca000?}, 0x6)
	go/parser/interface.go:133 +0x118 fp=0x8a8525fd0a0 sp=0x8a8525fcfe0 pc=0x197da8
cmd/go/internal/modindex.readGoInfo({0x758da0?, 0x8a852340020?}, 0x8a8525e1c80)

Full traces attached below:

What did you expect to see?

go build should not encounter a runtime fault.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.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