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/vet: copylock: infinite recursion through type parameters #49384

Closed
findleyr opened this issue Nov 5, 2021 · 2 comments
Closed

cmd/vet: copylock: infinite recursion through type parameters #49384

findleyr opened this issue Nov 5, 2021 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker Soon This needs to be done soon. (regressions, serious bugs, outages)
Milestone

Comments

@findleyr
Copy link
Contributor

findleyr commented Nov 5, 2021

We need to be careful to avoid infinite recursion in recursive vet checks that consider type parameters. The following code causes an infinite recursion in the new copylock logic (discovered when gopls crashed while working on similar handling for infinite recursion in the printf analyzer...).

func TestRecursiveTypeParams[T1 ~[]T2, T2 ~[]T1 | string, T3 ~struct{ F T3 }](t1 T1, t2 T2, t3 T3) {
}

I'll audit the other updated vet analyzers for similar problems.

CC @timothy-king

@findleyr findleyr added NeedsFix The path to resolution is known, but the work has not been done. release-blocker Soon This needs to be done soon. (regressions, serious bugs, outages) labels Nov 5, 2021
@findleyr findleyr added this to the Go1.18 milestone Nov 5, 2021
@findleyr findleyr self-assigned this Nov 5, 2021
@gopherbot
Copy link

Change https://golang.org/cl/361456 mentions this issue: go/analysis/passes/copylock: avoid infinite recursion via type params

@findleyr
Copy link
Contributor Author

findleyr commented Nov 5, 2021

Ok, I looked at all other places where we consider the structural terms of a type parameter, and they do not recurse. So CL 361456 should be sufficient.

@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker Soon This needs to be done soon. (regressions, serious bugs, outages)
Projects
None yet
Development

No branches or pull requests

2 participants