-
Notifications
You must be signed in to change notification settings - Fork 19.4k
x/tools/gopls: SEGV due to invalid g in brand new goroutine #76693
Copy link
Copy link
Open
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.gopls/memory-corruption"can't happen" gopls crashes (races, unsafe, miscompile, runtime bugs, faulty HW)"can't happen" gopls crashes (races, unsafe, miscompile, runtime bugs, faulty HW)gopls/telemetry-wins
Milestone
Description
Activity
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.gopls/memory-corruption"can't happen" gopls crashes (races, unsafe, miscompile, runtime bugs, faulty HW)"can't happen" gopls crashes (races, unsafe, miscompile, runtime bugs, faulty HW)gopls/telemetry-wins
Type
Projects
- StatusShow more project fieldsTodo
Issue created by stacks.
Well this is an interesting one: we have a brand new goroutine that has executed one stack check and one preemption check, and yet its its R28 (g) is corrupt by the time of the second stack check.
This means something has corrupted R28 between the two stack checks. The only code that has run in this thread are the checks themselves. I think this implies only one of three possibilities:
Of course, both of 1 and 2 could be explained by corruption of runtime internal data structures by an errant mutator, but I think we can safely conclude that the runtime must be involved in this corruption.
This stack
6__P9gwas reported by telemetry:crash/crashgolang.org/x/tools/gopls/internal/cache.(*parseCache).gc:+0,+0x0golang.org/x/tools/gopls/internal/cache.newParseCache.gowrap1:+0,+0x27runtime.goexit:+0,+0x3Use this command to reproduce the executable:
(HOME=$(mktemp -d); GOOS=darwin GOARCH=arm64 GOTOOLCHAIN=go1.25.4 go install golang.org/x/tools/gopls@v0.20.0 && find $HOME/go/bin -type f)To disassemble:
go tool objdump exe | less