Skip to content

go/types: SEGV in tpWalker.isParameterized, case Signature #79772

Description

@adonovan
#!stacks
"sigpanic" && "go/types.(*tpWalker).isParameterized:+45"

Issue created by stacks.

The failing source line is:

	case *Signature:
		// t.tparams may not be nil if we are looking at a signature
		// of a generic function type (or an interface method) that is
		// part of the type we're testing. We don't care about these type
		// parameters.
		// Similarly, the receiver of a method may declare (rather than
		// use) type parameters, we don't care about those either.
		// Thus, we only need to look at the input and result parameters.
		return t.params != nil && w.varList(t.params.vars) || t.results != nil && w.varList(t.results.vars) // <-- SEGV

The assembly shows that it is a load of t.params (field offset 32) that fails, indicating that t is an invalid pointer (either nil or garbage caused by a soft error):

TEXT go/types.(*tpWalker).isParameterized(SB) go
lang.org/toolchain@v0.0.1-go1.26.2.darwin-arm64/src/go/types/infer.go
  infer.go:561          0x1003def50             f9400b90                MOVD 16(R28), R16                               
...
  infer.go:576          0x1003df0e8             140000f6                JMP 246(PC)                                     
  infer.go:598          0x1003df0ec             b000a325                ADRP 21385216(PC), R5                           
  infer.go:598          0x1003df0f0             9101c0a5                ADD $112, R5, R5                                
  infer.go:598          0x1003df0f4             eb05007f                CMP R5, R3                                      
  infer.go:598          0x1003df0f8             54000f21                BNE 121(PC)                                     
->infer.go:606          0x1003df0fc             f9401043                MOVD 32(R2), R3 ; load t.params (SEGV) 
  infer.go:606          0x1003df100             b40000c3                CBZ R3, 6(PC)                                   
  infer.go:606          0x1003df104             a9401063                LDP (R3), (R3, R4)                              
  infer.go:606          0x1003df108             f90023e4                MOVD R4, 64(RSP)                                

This stack Rfu6uA was reported by telemetry:

golang.org/x/tools/gopls@v0.21.1 go1.26.2 darwin/arm64 gopls.client=other (1)

Use this command to reproduce the executable:
(HOME=$(mktemp -d); GOOS=darwin GOARCH=arm64 GOTOOLCHAIN=go1.26.2 go install golang.org/x/tools/gopls@v0.21.1 && find $HOME/go/bin -type f)
To disassemble: go tool objdump exe | less

Metadata

Metadata

Assignees

Labels

NeedsInvestigationSomeone 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.goplsIssues related to the Go language server, gopls.gopls/telemetry-wins

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions