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

x/tools/gopls: SEGV in gcimporter.iexportCommon (bad SP) #72135

Open
adonovan opened this issue Mar 6, 2025 · 2 comments
Open

x/tools/gopls: SEGV in gcimporter.iexportCommon (bad SP) #72135

adonovan opened this issue Mar 6, 2025 · 2 comments
Labels
BugReport Issues describing a possible bug in the Go implementation. compiler/runtime Issues related to the Go compiler and/or runtime. gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Mar 6, 2025

#!stacks
"sigpanic" && "gcimporter.(*iexporter).pushDecl:+0"

Issue created by stacks.

	for _, pkg := range pkgs {
		scope := pkg.Scope()
		for _, name := range scope.Names() {
			if token.IsExported(name) {
				p.pushDecl(scope.Lookup(name))  <---- in this call
func (p *iexporter) pushDecl(obj types.Object) { <---- SEGV
	// Package unsafe is known to the compiler and predeclared.
	// Caller should not ask us to do export it.
	if obj.Pkg() == types.Unsafe {

All memory-operand instructions on that source line are indicated by the comments below. None can fail unless the SP register or g (R14) is bad.

TEXT golang.org/x/tools/internal/gcimporter.(*iexporter).pushDecl(SB) /Users/adonovan/w/xtools/internal/gcimporter
/iexport.go
  iexport.go:654        0x16cd9c0               493b6610                CMPQ SP, 0x10(R14)	// load g.stackguard_00
  iexport.go:654        0x16cd9c4               0f86d4000000            JBE 0x16cda9e
  iexport.go:654        0x16cd9ca               55                      PUSHQ BP		// save FP
  iexport.go:654        0x16cd9cb               4889e5                  MOVQ SP, BP
  iexport.go:654        0x16cd9ce               4883ec18                SUBQ $0x18, SP
  ...
  iexport.go:654        0x16cd9d7               48895c2430              MOVQ BX, 0x30(SP)	// spill obj.t
  iexport.go:654        0x16cd9dc               48894c2438              MOVQ CX, 0x38(SP)	// spill obj.v

This stack R1nKxA was reported by telemetry:

golang.org/x/tools/[email protected] go1.23.4 darwin/amd64 neovim,vscode (1)
@adonovan adonovan added gopls Issues related to the Go language server, gopls. gopls/telemetry-wins NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository. labels Mar 6, 2025
@gopherbot gopherbot added this to the Unreleased milestone Mar 6, 2025
@adonovan
Copy link
Member Author

adonovan commented Mar 6, 2025

cc: @prattmic

@adonovan adonovan changed the title x/tools/gopls: SEGV in gcimporter.iexportCommon x/tools/gopls: SEGV in gcimporter.iexportCommon (bad SP) Mar 6, 2025
@adonovan adonovan added the compiler/runtime Issues related to the Go compiler and/or runtime. label Mar 6, 2025
@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. compiler/runtime Issues related to the Go compiler and/or runtime. gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants