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/internal/ld: panic in deadcode on darwin #33775

Closed
bcmills opened this issue Aug 22, 2019 · 6 comments
Closed

cmd/link/internal/ld: panic in deadcode on darwin #33775

bcmills opened this issue Aug 22, 2019 · 6 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Aug 22, 2019

Observed on the darwin-386-10_14 builder (https://build.golang.org/log/52334b038bdb15873c9661a4bd19a514d7d57626):

# fmt.test
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x5d pc=0x13b4e4]

goroutine 1 [running]:
cmd/link/internal/ld.(*deadcodepass).flood(0x11801924)
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/link/internal/ld/deadcode.go:352 +0x414
cmd/link/internal/ld.deadcode(0x117de000)
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/link/internal/ld/deadcode.go:61 +0x92
cmd/link/internal/ld.Main(0x3d0380, 0x10, 0x20, 0x1, 0x4, 0x8, 0x236bde, 0x12, 0x239da0, 0x18, ...)
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/link/internal/ld/main.go:211 +0x9a2
main.main()
	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/link/main.go:65 +0x161
FAIL	fmt [build failed]

See previously #17140, #16887.

CC @cherrymui @mdempsky @ianlancetaylor

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 22, 2019
@bcmills bcmills added this to the Go1.14 milestone Aug 22, 2019
@odeke-em
Copy link
Member

odeke-em commented Sep 9, 2019

Thank you for the report Bryan!

Empirically that code doesn't make sense unless there perhaps was a data race or just data corruption that made s.FuncInfo nil, because the line it is failing on, given commit e764432 as per the logs, the line is

for i := range s.FuncInfo.Funcdata {

and right before it, we explicitly checked that s.FuncInfo != nil as per

if s.FuncInfo != nil {
for i := range s.FuncInfo.Funcdata {
d.mark(s.FuncInfo.Funcdata[i], s)
}
}

And that code seems to be invoked sequentially.

@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
@bcmills bcmills changed the title cmd/link: panic in (*deadcodepass).flood cmd/link/internal/ld: panic in deadcode Nov 12, 2019
@bcmills bcmills changed the title cmd/link/internal/ld: panic in deadcode cmd/link/internal/ld: panic in deadcode on darwin Nov 12, 2019
@bcmills bcmills modified the milestones: Backlog, Go1.14 Nov 12, 2019
@jeremyfaller
Copy link
Contributor

Unusual looking bug to me. That LOC is unlikely to fail unless AllSyms has ben corrupted with a nil symbol and I don't see how that's really possible. If we check for nil at this location, we'll be playing whack-a-mole through the rest of the linker checking for nil every time we loop through AllSym.

The only three possibilities that come to mind are: some different runtime memory bug that's manifesting here, a bug in mmap for darwin, or a bad machine we just happen to get unlucky with.

@bcmills
Copy link
Contributor Author

bcmills commented Nov 12, 2019

A bad machine seems unlikely, given the consistency of the stack trace and the number of occurrences. Either of the other two seems more plausible.

@ianlancetaylor
Copy link
Contributor

@toothrot toothrot modified the milestones: Go1.14, Go1.15 Feb 25, 2020
@ianlancetaylor
Copy link
Contributor

I don't see any occurrences for several months, and we've merged a new linker. Likely fixed.

@golang golang locked and limited conversation to collaborators May 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin
Projects
None yet
Development

No branches or pull requests

7 participants