Skip to content

runtime: SIGBUS during runtime.init when running an executable stored on GCS via gcsfuse #48997

Open
@tetsuok

Description

@tetsuok

What version of Go are you using (go version)?

$ go version
go version go1.17.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tetsuo.kiso/.cache/go-build"
GOENV="/home/tetsuo.kiso/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/tetsuo.kiso/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/tetsuo.kiso/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1844747333=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Ran a Go executable stored on GCS via gcsfuse (v0.35.1) after clearing the cache on Linux.
The following is the repro step. Assumes there is a GCS bucket (my_bucket in this case).

$ mkdir gcs
$ gcsfuse -o rw -file-mode=777 -dir-mode=777 --foreground my_bucket ./gcs &
$ cat hello.go
package main

import (
        "fmt"
)

func main() {
        fmt.Println("hello, world!")
}
$ go build -gcflags=all='-N -l' -o ./gcs/hello hello.go

# Clear cache on Linux by unmounting and mounting the bucket.
$ fusermount -u gcs
$ gcsfuse -o rw -file-mode=777 -dir-mode=777 --foreground my_bucket ./gcs &

$ ./gcs/hello

What did you expect to see?

It runs successfully.

What did you see instead?

unexpected fault address 0x4d21dd
fatal error: fault
[signal SIGBUS: bus error code=0x2 addr=0x4d21dd pc=0x44f0a9]

goroutine 1 [running, locked to thread]:
runtime.throw({0x4aac19, 0x0})
        /usr/local/go/src/runtime/panic.go:1198 +0x71 fp=0xc000056558 sp=0xc000056528 pc=0x432d11
runtime.sigpanic()
        /usr/local/go/src/runtime/signal_unix.go:732 +0xb6 fp=0xc000056588 sp=0xc000056558 pc=0x446eb6
runtime.step({0x4d21dd, 0x7331, 0x0}, 0xc000056608, 0x44de3d, 0x0)
        /usr/local/go/src/runtime/symtab.go:1030 +0x29 fp=0xc0000565d0 sp=0xc000056588 pc=0x44f0a9
runtime.funcMaxSPDelta({0x4fc4f8, 0x51d740})
        /usr/local/go/src/runtime/symtab.go:973 +0xb4 fp=0xc000056628 sp=0xc0000565d0 pc=0x44ec54
runtime.init.6()
        /usr/local/go/src/runtime/preempt.go:321 +0x56 fp=0xc000056650 sp=0xc000056628 pc=0x433df6
runtime.doInit(0x51abc0)
        /usr/local/go/src/runtime/proc.go:6498 +0x127 fp=0xc000056780 sp=0xc000056650 pc=0x4421c7
runtime.main()
        /usr/local/go/src/runtime/proc.go:204 +0xf3 fp=0xc0000567e0 sp=0xc000056780 pc=0x435173
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc0000567e8 sp=0xc0000567e0 pc=0x45f721

Note that the crash doesn't happen if the file is being cached.

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

    Status

    Triage Backlog

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions