-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
RFC: remove user/group name support from libcontainer #3998
Comments
Related to #3181, which was filed 2 years and 4 days ago and has some very relevant comments. |
To be clear, the implied proposal is that this code moves into moby/moby, containerd, and other callers? (I think most of them rely on runc for this code, but maybe it's already been copied/reimplemented?) |
At a quick glance, I think there's two parts here;
For the former, I can see that being ok (at least I think we may already be passing uid/gid) For the latter, I see (at least at quick glance) that
Perhaps it would be worth to;
|
It's been a while since I reworked the user code -- do we use the I would be in favour of moving the code to a containerd/ or the moby/sys repo. This code was part of the original libcontainer codebase within docker and we just carried it through to runc. I think Docker also depends on libcontainer/user (unless that has been completely moved to containerd). |
|
OK here's the rough plan:
|
(whoops; was writing up a reply, but looks like I didn't post it); here goes;
Yes, I'd be "+1" to move it there; agreed that that would be a good fit (other modules in that repository also deal with e.g. If we do the move, we should preserve Git history (as we did with the other package).
Note that For os.LookupId(), I wonder if that would work, because we need to lookup the HOME based on the container environment, not the "current" environment? We also must be careful with stdlib, as it has some It will use a cached version of that information;
For the parsing utilities, we can provide temporary aliases (and mark them deprecated). It runc itself stops using them, it's ok to remove those aliases in a follow-up release (they'll act to help to "alert" consumers, and to help them transition to the new location, without breaking immediately) For the types, we must look carefully; is there any code that needs to interact with runc's types from a Go perspective (and those types to contain one of the There's 4 types, and 3 errors that are exported;
Looking at those, only |
I was wondering the same thing, but we actually do the lookup after |
Description
There is a way to specify user, group, and additional groups in the OCI spec here. It is very clear from the spec that all the fields are numeric UIDs and GIDs.
Yet,
In libcontainer these fields are strings:
runc/libcontainer/process.go
Lines 29 to 35 in b322e31
So,
runc
converts from numeric UID and GID to a string (like "$UID:$GID"):runc/utils_linux.go
Lines 51 to 52 in b322e31
and does the same for additional GIDs:
runc/utils_linux.go
Lines 72 to 74 in b322e31
/etc/passwd
and/etc/group
to find out the numeric UID and GID back from theUser
string, and does the same for every additional GID.I imagine that makes every
runc run
andrunc exec
slower than it could be, and is totally unnecessary.I propose to remove this functionality of resolving user/group names from libcontainer, and only read /etc/passwd in case
$HOME
is not set.The text was updated successfully, but these errors were encountered: