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
os/exec: better support for user namespaces #50098
Comments
This is supposed to be done by using the |
Behavior is the same no matter if I use Software like |
What would we have to change to make this work? Thanks. |
I believe ready to use implementation is here: https://github.com/containers/storage/tree/main/pkg/unshare/ |
BTW: the best approach IMO would be to implement
Whenever someone shares this idea golang team answers that the correct way of doing this is to use
Imagine this situation: |
It's infeasible to implement Thanks for pointing to the package. There is a lot there, and I don't know what matters. It would help this proposal a great deal if you or somebody could write down exactly what would need to be added to |
I'm not a C expert but linked library works this way:
// #cgo CFLAGS: -Wall -Wextra
// extern void _containers_unshare(void);
// void __attribute__((constructor)) init(void) {
// _containers_unshare();
// }
import "C"
And this is the flow:
In this setup flags for Entire process is sooooo complicated... |
We are not going to permit calling ordinary Go code between I don't know what the For this proposal to move forward we're going to need more precise details as to exactly what needs to be implemented in the syscall package. I'm going to put this on hold for now. |
https://man7.org/linux/man-pages/man1/newuidmap.1.html
I think I provided all the details on how the flow should look like. But once again:
go is frequently used to develop containerization engines so it would be nice to implement this once for all. |
Why is it necessary to call an external binary to make this work? Why can't we do this entirely with system calls? |
Unprivileged user may create only a single mapping: |
I have this scenario:
unshare
syscall allows me to maproot
user only.podman
is able to map subids too by callingnewuidmap
andnewgidmap
(it is implemented here: https://github.com/containers/storage/tree/main/pkg/unshare/unshare_linux.go)exec.Cmd
plus some C code to callunshare
in the middle of the process, after setting full mapping setsyscall.Unshare(syscall.CLONE_NEWUSER)
returnsinvalid argument
error even if called from goroutine pinned to thread.It would be nice to have more "goish" way to do it, like this:
The text was updated successfully, but these errors were encountered: