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

Always close fd's returned from internal.BPFProgLoad #373

Closed
ti-mo opened this issue Aug 12, 2021 · 0 comments · Fixed by #428
Closed

Always close fd's returned from internal.BPFProgLoad #373

ti-mo opened this issue Aug 12, 2021 · 0 comments · Fixed by #428
Labels
bug Something isn't working

Comments

@ti-mo
Copy link
Collaborator

ti-mo commented Aug 12, 2021

There are a few places where internal.BPFProgLoad's return value is discarded, relying on the GC to close FDs using their finalizers. Relying on this is not ideal, since it's possible to run Go programs with GC disabled.

In newProgramWithOptions(), this is only done when re-running the prog load with verifier output enabled, but it's still theoretically possible for a retry to succeed and yield an fd. We should at least handle the fd if one happens to be returned.

In features/ this is also done in a few places, and it should definitely be handled correctly there. (@rgo3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant