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

Avoid using os.Newfile() for seccomp fds #10

Open
rata opened this issue Apr 23, 2021 · 0 comments
Open

Avoid using os.Newfile() for seccomp fds #10

rata opened this issue Apr 23, 2021 · 0 comments

Comments

@rata
Copy link
Member

rata commented Apr 23, 2021

Current situation
We use os.NewFile() when receiving an fds, as seen here. Tricks to keep a reference alban was using, when I tested with a different agent at least, fail if the agent runs for a long time.

Impact
The go runtime can close the fd if considers we are not using it anymore. See the notes here: https://pkg.go.dev/os#NewFile.

That is totally legit for the go runtime to believe, as we are not using that object, but just the fd number.

The result is the target container will stop working and will need to be restarted.

Ideal future situation
Don't return an object that can be garbage collected and that would mean closing the fd

Implementation options
Just returning an uintptr should be enough, and addapting the functions signatures. Should be trivial, but I don't have the time to test it now, so opening an issue so we don't forget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant