-
Notifications
You must be signed in to change notification settings - Fork 9
Avoid using os.Newfile() for seccomp fds #10
Description
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.