From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman) Subject: Re: [PATCH 11/11] newuidmap, newgidmap: New suid helpers for using subordinate uids and gids Date: Fri, 25 Oct 2013 17:42:12 -0700 Message-ID: <87zjpw278b.fsf@xmission.com> References: <87d2wxshu0.fsf@xmission.com> <87ehhdpoag.fsf@xmission.com> <20131025203025.GA2467@mail.hallyn.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20131025203025.GA2467-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org> (Serge E. Hallyn's message of "Fri, 25 Oct 2013 20:30:25 +0000") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: "Serge E. Hallyn" Cc: Linux Containers , Pkg-shadow-devel-XbBxUvOt3X2LieD7tvxI8l/i77bcL1HB@public.gmane.org, "Michael Kerrisk (man-pages)" , Nicolas =?utf-8?Q?Fran=C3=A7ois?= List-Id: containers.vger.kernel.org "Serge E. Hallyn" writes: > Quoting Eric W. Biederman (ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org): > > Hi, > >> +static bool verify_range(struct passwd *pw, struct map_range *range) >> +{ >> + /* An empty range is invalid */ >> + if (range->count == 0) >> + return false; >> + >> + /* Test /etc/subuid */ >> + if (have_sub_uids(pw->pw_name, range->lower, range->count)) >> + return true; > > I think the have_sub_uids() test should be skipped if we started > out as root. Is there a reason not to do that? The only reason I can see for root to use this binary is if it a flavor of root that has dropped some capbilities. Is there a reason for root to use newuidmap and newgid map at all? Otherwise I think it makes sense to enforce whatever the system choosen policy is on root, because root is opting in. Eric