Skip to content

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

@rata

Description

@rata

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions