-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: syscall: Support linux namespace fd's in SysProcAttr #56680
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
Comments
I like the overall idea, but perhaps some higher-level way of specifying the namespaces is better. Say something like Namespaces []string where each element is in the form "type:path". The What the code would do is map those types to
|
@kolyshkin I think that could work, though it is definitely different from other things, such as I'm fine either way. |
@kolyshkin Is there any issue with having to do the parsing on that string in the syscall package? |
Is there something we can do to move this discussion forward? Does this need to be in the active discussion list before a change should be submitted? /cc @rsc |
You can send in a change any time but it won't be approved and submitted until this proposal is accepted. In this case actually I think seeing the code would help, as I don't really understand the proposal myself. Thanks. I see there is a suggestion above for a different approach, and that doesn't seem to be settled. We aim to get consensus on proposals. @kolyshkin any more thoughts on the approach? Thanks. |
I opened #59018 for this. |
Change https://go.dev/cl/476095 mentions this issue: |
This adds a Namespaces field to Linux's SysProcAttr type. When set, these namespaces will be entered after fork and before exec. The format for this is [ns name]=[path], e.g. mnt=/some/path. This allows users to exec a new process in a pre-defined set of namespaces without having to resort to hacks or re-execs to bootstrap these namespaces. Closes golang#56680
This adds a Namespaces field to Linux's SysProcAttr type. When set, these namespaces will be entered after fork and before exec. The format for this is [ns name]=[path], e.g. mnt=/some/path. This allows users to exec a new process in a pre-defined set of namespaces without having to resort to hacks or re-execs to bootstrap these namespaces. Closes golang#56680
This adds a Namespaces field to Linux's SysProcAttr type. When set, these namespaces will be entered after fork and before exec. This allows users to exec a new process in a pre-defined set of namespaces without having to resort to hacks or re-execs to bootstrap these namespaces. Closes golang#56680
I've been working on a package to help work on Linux namespaces (https://github.com/cpuguy83/gonso).
One of the things I'd like to be able to do is, as a library author, enable users of the library to run an executable in a given set of namespaces.
Today this would require the user of the library to have a helper process join those namespaces before executing the command.
In the library I could setup a thread with the namespaces and run the command but this doesn't really work with
exec.Cmd
since that can spin up its own goroutines not locked to the current thread.I've also looked at creating essentially my own bad copy of
exec.Cmd
that would allow me to do this but ideally this would just work with the realexec.Cmd
What I propose is to add something like:
I think this is a more generally useful addition since it allows anyone to set which namepsaces they want the command to run in without having to resort to using external tooling (such as nsenter) or re-exec/cgo init hacks.
The text was updated successfully, but these errors were encountered: