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: segmentation fault during mach-o linking #33776

Open
bcmills opened this issue Aug 22, 2019 · 1 comment

Comments

@bcmills
Copy link
Member

commented Aug 22, 2019

Seen in the darwin-amd64-nocgo builder (https://build.golang.org/log/c13c6d21b5bfb8d2220b0244e381440eb959415b), an unexpected fault address in strings.IndexByte during linking.

(I'm not sure whether the linker is playing any interesting games with mapped memory at this point, so if you can rule out a linker bug please file an issue against an appropriate other package.)

# crypto/rc4.test
unexpected fault address 0x1800000020
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0x1800000020 pc=0x1002a7c]

goroutine 1 [running]:
runtime.throw(0x128e871, 0x5)
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/runtime/panic.go:774 +0x72 fp=0xc000749098 sp=0xc000749068 pc=0x102d312
runtime.sigpanic()
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/runtime/signal_unix.go:401 +0x3de fp=0xc0007490c8 sp=0xc000749098 pc=0x104236e
indexbytebody(0x1800000020, 0xc00133c210, 0x62e, 0x198e, 0xc000485940, 0xc000749140, 0x11a357c, 0x1246ca0, 0xc000478000, 0x1290a2b, ...)
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/internal/bytealg/indexbyte_amd64.s:48 +0x2c fp=0xc0007490d0 sp=0xc0007490c8 pc=0x1002a7c
strings.IndexByte(...)
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/strings/strings.go:151
strings.Index(0x1800000020, 0xc00133c210, 0x128e22a, 0x1, 0x8)
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/strings/strings.go:1033 +0x5f7 fp=0xc000749150 sp=0xc0007490d0 pc=0x10c3ae7
strings.Contains(...)
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/strings/strings.go:99
cmd/link/internal/ld.machosymtab(0xc00006a000)
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/link/internal/ld/macho.go:880 +0x25a fp=0xc0007491e8 sp=0xc000749150 pc=0x11a382a
cmd/link/internal/ld.Domacholink(0xc00006a000, 0x525bfff)
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/link/internal/ld/macho.go:952 +0x2f fp=0xc000749260 sp=0xc0007491e8 pc=0x11a46bf
cmd/link/internal/amd64.asmb2(0xc00006a000)
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/link/internal/amd64/asm.go:712 +0x7d4 fp=0xc0007492d0 sp=0xc000749260 pc=0x11d1d24
cmd/link/internal/ld.Main(0x1452fa0, 0x10, 0x20, 0x1, 0x7, 0x10, 0x129829b, 0x1b, 0x1294ecd, 0x14, ...)
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/link/internal/ld/main.go:271 +0xd9a fp=0xc000749428 sp=0xc0007492d0 pc=0x11aaa6a
main.main()
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/link/main.go:65 +0x1d6 fp=0xc000749f60 sp=0xc000749428 pc=0x1213a96
runtime.main()
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/runtime/proc.go:203 +0x21e fp=0xc000749fe0 sp=0xc000749f60 pc=0x102ec9e
runtime.goexit()
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc000749fe8 sp=0xc000749fe0 pc=0x1059b31
FAIL	crypto/rc4 [build failed]

@cherrymui @mdempsky @ianlancetaylor @jeremyfaller

@bcmills bcmills added this to the Go1.14 milestone Aug 22, 2019

@cherrymui

This comment has been minimized.

Copy link
Contributor

commented Aug 22, 2019

We do use mmap on darwin but this doesn't seem like caused by mapped memory to me, because

  • we never unmap memory
  • the string length, 0xc00133c210, seems wrong. But the string length does not come from mapped memory, at least not directly.

But I can't be sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.