Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: segfaults occuring when using lld as default linker on linux/arm64 #61872

Closed
kraj opened this issue Aug 8, 2023 · 3 comments
Closed
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@kraj
Copy link

kraj commented Aug 8, 2023

Following crash is seen When using lld as default linker on aarch64/linux, it works fine if BFD linker is used.
The default linker has to be selected systemwide and not just for building the application ( crucible in this case )
some other apps which show same problem are gosu, syzkaller and influxdb. This is aarch64/linux/lld specific and can be seen on musl or glibc bullds. I am using yocto project to build this. I can get more information. If someone can guide me on what to extract which will be useful.

Here is the segfault detail.

# github.com/usbarmory/crucible/cmd/crucible
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x57829a]

goroutine 1 [running]:
cmd/link/internal/ld.decodetypeGcmask(0xc00011e000, 0xc000036ea8?)
	TOPDIR/build/tmp/work/x86_64-linux/go-cross-cortexa57/1.20.7-r0/recipe-sysroot-native/usr/lib/aarch64-yoe-linux-musl/go/src/cmd/link/internal/ld/decodesym.go:251 +0x37a
cmd/link/internal/ld.(*GCProg).AddSym(0xc00186d860, 0x86a)
	TOPDIR/build/tmp/work/x86_64-linux/go-cross-cortexa57/1.20.7-r0/recipe-sysroot-native/usr/lib/aarch64-yoe-linux-musl/go/src/cmd/link/internal/ld/data.go:1317 +0x18e
cmd/link/internal/ld.(*dodataState).allocateDataSections(0xc000592a00, 0xc00011e000)
	TOPDIR/build/tmp/work/x86_64-linux/go-cross-cortexa57/1.20.7-r0/recipe-sysroot-native/usr/lib/aarch64-yoe-linux-musl/go/src/cmd/link/internal/ld/data.go:1844 +0x4998
cmd/link/internal/ld.(*Link).dodata(0xc00011e000, {0xc001c88000, 0x1a4ac, 0x1a4ac})
	TOPDIR/build/tmp/work/x86_64-linux/go-cross-cortexa57/1.20.7-r0/recipe-sysroot-native/usr/lib/aarch64-yoe-linux-musl/go/src/cmd/link/internal/ld/data.go:1634 +0xb07
cmd/link/internal/ld.Main(_, {0x10, 0x20, 0x1, 0x1f, 0x1e, 0x7c00000, {0x69331a, 0x14}, {0x69711d, ...}, ...})
	TOPDIR/build/tmp/work/x86_64-linux/go-cross-cortexa57/1.20.7-r0/recipe-sysroot-native/usr/lib/aarch64-yoe-linux-musl/go/src/cmd/link/internal/ld/main.go:338 +0x153b
main.main()
	TOPDIR/build/tmp/work/x86_64-linux/go-cross-cortexa57/1.20.7-r0/recipe-sysroot-native/usr/lib/aarch64-yoe-linux-musl/go/src/cmd/link/main.go:72 +0xedb
WARNING: TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/crucible/2023.04.12-r0/temp/run.do_compile.2587767:174 exit 1 from 'aarch64-yoe-linux-musl-go install -linkshared -p 10 -v -ldflags="-r /usr/lib/go/pkg/linux_arm64_dynlink  -I /lib/ld-musl-aarch64.so.1  -extldflags '-target aarch64-yoe-linux-musl  -mcpu=cortex-a57 -march=armv8-a+crc -mbranch-protection=standard -mlittle-endian --dyld-prefix=/usr -Qunused-arguments -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/crucible/2023.04.12-r0/recipe-sysroot -Wl,-rpath-link=TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/crucible/2023.04.12-r0/recipe-sysroot/usr/lib/go/pkg/linux_arm64_dynlink -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed   -fmacro-prefix-map=TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/crucible/2023.04.12-r0/crucible-2023.04.12=/usr/src/debug/crucible/2023.04.12-r0  -fdebug-prefix-map=TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/crucible/2023.04.12-r0/crucible-2023.04.12=/usr/src/debug/crucible/2023.04.12-r0  -fmacro-prefix-map=TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/crucible/2023.04.12-r0/build=/usr/src/debug/crucible/2023.04.12-r0  -fdebug-prefix-map=TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/crucible/2023.04.12-r0/build=/usr/src/debug/crucible/2023.04.12-r0  -fdebug-prefix-map=TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/crucible/2023.04.12-r0/recipe-sysroot=  -fmacro-prefix-map=TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/crucible/2023.04.12-r0/recipe-sysroot=  -fdebug-prefix-map=TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/crucible/2023.04.12-r0/recipe-sysroot-native=  -Wl,-z,relro,-z,now   -fuse-ld=lld'" -trimpath -modcacherw -buildmode=pie `go_list_packages`'
@seankhliao seankhliao changed the title Segfaults occuring when using lld as default linker on aarch64/linux cmd/link: segfaults occuring when using lld as default linker on aarch64/linux Aug 9, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Aug 9, 2023
@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 9, 2023
@mknyszek mknyszek changed the title cmd/link: segfaults occuring when using lld as default linker on aarch64/linux cmd/link: segfaults occuring when using lld as default linker on linux/arm64 Aug 9, 2023
@mknyszek
Copy link
Contributor

mknyszek commented Aug 9, 2023

CC @golang/compiler

@mknyszek mknyszek added this to the Backlog milestone Aug 9, 2023
@mknyszek
Copy link
Contributor

mknyszek commented Aug 9, 2023

Which version of Go are you using, and what commands did you run to reproduce the issue? Thanks.

@mknyszek mknyszek added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 9, 2023
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants