Skip to content

runtime: segfaults in cross compiled binaries for solaris 11.3 #61950

Open
@karlik8899

Description

@karlik8899

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

$ go version
go version go1.21.0 linux/amd64

Does this issue reproduce with the latest release?

yes

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

linux centos 8

go env Output
$ go env
GO111MODULE='auto'
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/x/.cache/go-build'
GOENV='/home/x/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/x/go/pkg/mod'
GOOS='linux'
GOPATH='/home/x/go'
GOPROXY='https://proxy.golang.org'
GOROOT='/opt/go1.21.0'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/go1.21.0/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/x/myrepo/test2/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1105527576=/tmp/go-build -gno-record-gcc-switches'

What did you do?

func main() {
fmt.Println("Abcd")
}

env GOOS=solaris GOARCH=amd64 CGO_ENABLED=0 go build -o test-sol-1.21.0

What did you expect to see?

Abcd

What did you see instead?

Segmentation Fault (core dumped)

sotruss ~/test-sol-1.21.0
test-sol-1.21.0 -> libc.so:*sysconf(0xf, 0xffff80ffbffff6a0, 0x42ce0f)
test-sol-1.21.0 -> libc.so:*mmap(0x0, 0x40000, 0x3)
test-sol-1.21.0 -> libc.so:*mmap(0x0, 0x20000, 0x0)
test-sol-1.21.0 -> libc.so:*mmap(0x0, 0x100000, 0x0)
test-sol-1.21.0 -> libc.so:*mmap(0x0, 0x800000, 0x0)
test-sol-1.21.0 -> libc.so:*mmap(0x0, 0x4000000, 0x0)
test-sol-1.21.0 -> libc.so:*mmap(0x0, 0x20000000, 0x0)
test-sol-1.21.0 -> libc.so:*mmap(0x0, 0x20000000, 0x0)
test-sol-1.21.0 -> libc.so:*mmap(0xc000000000, 0x4000000, 0x0)
test-sol-1.21.0 -> libc.so:*mmap(0x0, 0x2000000, 0x3)
test-sol-1.21.0 -> libc.so:*mmap(0x0, 0x114c10, 0x3)
test-sol-1.21.0 -> libc.so:*mmap(0xc000000000, 0x400000, 0x3)
test-sol-1.21.0 -> libc.so:*mmap(0xffff80ffbf625000, 0x20000, 0x3)
test-sol-1.21.0 -> libc.so:*mmap(0xffff80ffbe97f000, 0x1000, 0x3)
test-sol-1.21.0 -> libc.so:*mmap(0xffff80ffbde06000, 0x1000, 0x3)
test-sol-1.21.0 -> libc.so:*mmap(0xffff80ffbb830000, 0x1000, 0x3)
test-sol-1.21.0 -> libc.so:*mmap(0xffff80ffa9780000, 0x1000, 0x3)
test-sol-1.21.0 -> libc.so:*mmap(0xffff80ff89580000, 0x1000, 0x3)
test-sol-1.21.0 -> libc.so:*mmap(0x0, 0x100000, 0x3)
test-sol-1.21.0 -> libc.so:*mmap(0x0, 0x10000, 0x3)
test-sol-1.21.0 -> libc.so:*mmap(0x0, 0x10000, 0x3)
test-sol-1.21.0 -> libc.so:*open(0x52d4b0, 0x0, 0x0)
/usr/bin/sotruss: line 78: 277: Memory fault(coredump)

ldd ~/test-sol-1.21.0
libsendfile.so => /lib/64/libsendfile.so
libsocket.so => /lib/64/libsocket.so
libc.so => /lib/64/libc.so
libnsl.so.1 => /lib/64/libnsl.so.1
libmp.so.2 => /lib/64/libmp.so.2
libucrypto.so.1 => /lib/64/libucrypto.so.1
libelf.so.1 => /lib/64/libelf.so.1
libcryptoutil.so.1 => /lib/64/libcryptoutil.so.1
libz.so.1 => /lib/64/libz.so.1

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.OS-Solariscompiler/runtimeIssues related to the Go compiler and/or runtime.help wanted

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions