Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp96768ybv; Tue, 18 Feb 2020 18:37:24 -0800 (PST) X-Google-Smtp-Source: APXvYqw27VJ8DgzKmeeBaLC8AW34I8Md86b6F2WvSdrSIJgp+2LopnHhUO1nrssC1v3J5f4v7iUZ X-Received: by 2002:a9d:7d9a:: with SMTP id j26mr17125137otn.21.1582079844706; Tue, 18 Feb 2020 18:37:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582079844; cv=none; d=google.com; s=arc-20160816; b=jpYgcpqk3P1WhLNnUmZZ3Zt8L7Hk9LZf7Ig6jA4kF6y1SDgqHLJcLYeQthW4+wzfso tLP0hS18+94u0qER9uQvZJvhTvDK1lZaHXypkPTjKQWmIXNJqndemEff/d43NLDTaPgs 4h7KVfFfGBOiXqiO2vbimUd0e448bTdOS9NeDk5yQQ/QEyzvlLAphFqwR8mnRl/408T6 E14WAjOMlejPtheBz4zS+bMLy9KlVXgbag8gHCEn2nb+Lcvcalty6IgkthX8S55yVxwM vpWr3Kyp9al91r990fmhoiBTU+AFVp355iYIBMM0EfmauJdzmeRq9QVvEOcd0btUMFsj XiuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=z2mfFnCc/nl633mFf4+FySLi5w5CQBCJTRYdv6gT0Ao=; b=jpdy6d06CNAyU0agjxjw9m+D/4NDwGRHqs4xuqbE/RXu3gOBFDdRF5EzX+JceklaDx PuE9OTV33DoSFj2mUtOKQT9a90rBgPqg1RVVIsX05MibHU2ubRBv3LUiXXPKm3Wmac4c h424OKUe/yDJSxMB3CSvAghE474/OwzWly4mDbeWy/iMTYZk0Gjb4/kEueWAqrCdB0XT CBJegudgngNIi3yo8i6+td+aRu/KEEYvakoy8uEKoImPaAoI7D9x1CDt0i2M4GYKzgcP 4/JgiSh6J8pWpUqvkFVhL7+6J6L7Db/4BzdNbfgGhqPGuVb2FUlmkbrUxm1KGRYMj5r9 6Eog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si8349964oie.265.2020.02.18.18.37.12; Tue, 18 Feb 2020 18:37:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728175AbgBSCgW (ORCPT + 99 others); Tue, 18 Feb 2020 21:36:22 -0500 Received: from mail.hallyn.com ([178.63.66.53]:49514 "EHLO mail.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728069AbgBSCgW (ORCPT ); Tue, 18 Feb 2020 21:36:22 -0500 Received: by mail.hallyn.com (Postfix, from userid 1001) id E304F1090; Tue, 18 Feb 2020 20:36:19 -0600 (CST) Date: Tue, 18 Feb 2020 20:36:19 -0600 From: "Serge E. Hallyn" To: Christian Brauner Cc: =?iso-8859-1?Q?St=E9phane?= Graber , "Eric W. Biederman" , Aleksa Sarai , Jann Horn , smbarber@chromium.org, Seth Forshee , Alexander Viro , Alexey Dobriyan , Serge Hallyn , James Morris , Kees Cook , Jonathan Corbet , Phil Estes , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, containers@lists.linux-foundation.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH v3 07/25] proc: task_state(): use from_kfs{g,u}id_munged Message-ID: <20200219023619.GE19144@mail.hallyn.com> References: <20200218143411.2389182-1-christian.brauner@ubuntu.com> <20200218143411.2389182-8-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200218143411.2389182-8-christian.brauner@ubuntu.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 18, 2020 at 03:33:53PM +0100, Christian Brauner wrote: > If fsid mappings have been written, this will cause proc to look at fsid > mappings for the user namespace. If no fsid mappings have been written the > behavior is as before. > > Here is part of the output from /proc//status from the initial user > namespace for systemd running in an unprivileged container as user namespace > root with id mapping 0 100000 100000 and fsid mapping 0 300000 100000: > > Name: systemd > Umask: 0000 > State: S (sleeping) > Tgid: 13023 > Ngid: 0 > Pid: 13023 > PPid: 13008 > TracerPid: 0 > Uid: 100000 100000 100000 300000 > Gid: 100000 100000 100000 300000 > FDSize: 64 > Groups: > > Signed-off-by: Christian Brauner Acked-by: Serge Hallyn > --- > /* v2 */ > unchanged > > /* v3 */ > unchanged > --- > fs/proc/array.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fs/proc/array.c b/fs/proc/array.c > index 5efaf3708ec6..d4a04f85a67e 100644 > --- a/fs/proc/array.c > +++ b/fs/proc/array.c > @@ -91,6 +91,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -193,11 +194,11 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, > seq_put_decimal_ull(m, "\nUid:\t", from_kuid_munged(user_ns, cred->uid)); > seq_put_decimal_ull(m, "\t", from_kuid_munged(user_ns, cred->euid)); > seq_put_decimal_ull(m, "\t", from_kuid_munged(user_ns, cred->suid)); > - seq_put_decimal_ull(m, "\t", from_kuid_munged(user_ns, cred->fsuid)); > + seq_put_decimal_ull(m, "\t", from_kfsuid_munged(user_ns, cred->fsuid)); > seq_put_decimal_ull(m, "\nGid:\t", from_kgid_munged(user_ns, cred->gid)); > seq_put_decimal_ull(m, "\t", from_kgid_munged(user_ns, cred->egid)); > seq_put_decimal_ull(m, "\t", from_kgid_munged(user_ns, cred->sgid)); > - seq_put_decimal_ull(m, "\t", from_kgid_munged(user_ns, cred->fsgid)); > + seq_put_decimal_ull(m, "\t", from_kfsgid_munged(user_ns, cred->fsgid)); > seq_put_decimal_ull(m, "\nFDSize:\t", max_fds); > > seq_puts(m, "\nGroups:\t"); > -- > 2.25.0