-
Notifications
You must be signed in to change notification settings - Fork 1
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
Track goroutine pointer usage like unsafe pointers #28
Comments
github-vet/rangeloop-pointer-findings#7151 could potentially motivate this change. A constant was being passed to a logging function call, and it triggered |
Right now, I'm thinking that the large graphs found in issues like this one would motivate this change. |
#101 may obviate the need for this. |
best-case scenario: we start checking each function that starts a goroutine and accepts a pointer using an analysis very much like loopclosure, exchanging range-loop variables for pointer arguments. This would tell us if the pointer argument is actually referred to inside the goroutine. Actually; the above idea can be implemented separately from this ticket to weed out functions which start a goroutine but don't refer to any of their pointer arguments within the goroutine call. |
#110 should be done first; since it's simpler. |
This is actually much simpler than I thought. Pointerescapes already checks third-party code and code that writes a pointer. It's simple to have it check to see whether a pointer is used inside a goroutine as well. |
The
pointerescape
analysis pass checks each pointer argument of each function call, whereas thenogofunc
pass does not. Since we're already doing it forpointerescape
, it would be simple to determine if a pointer argument is used during a goroutine and thread this information back through the callgraph like we do there.That may or may not be needed, though. It depends how many false-positives that analyzer is picking up.
The text was updated successfully, but these errors were encountered: