[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210120120310.6tczonwl3rdtnyu3@wittgenstein>
Date: Wed, 20 Jan 2021 13:03:10 +0100
From: Christian Brauner <christian.brauner@...ntu.com>
To: Jann Horn <jannh@...gle.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Christoph Hellwig <hch@...radead.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
John Johansen <john.johansen@...onical.com>,
James Morris <jmorris@...ei.org>,
Mimi Zohar <zohar@...ux.ibm.com>,
Dmitry Kasatkin <dmitry.kasatkin@...il.com>,
Stephen Smalley <stephen.smalley.work@...il.com>,
Casey Schaufler <casey@...aufler-ca.com>,
Arnd Bergmann <arnd@...db.de>,
Andreas Dilger <adilger.kernel@...ger.ca>,
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
Geoffrey Thomas <geofft@...reload.com>,
Mrunal Patel <mpatel@...hat.com>,
Josh Triplett <josh@...htriplett.org>,
Andy Lutomirski <luto@...nel.org>,
Theodore Tso <tytso@....edu>, Alban Crequy <alban@...volk.io>,
Tycho Andersen <tycho@...ho.ws>,
David Howells <dhowells@...hat.com>,
James Bottomley <James.Bottomley@...senpartnership.com>,
Seth Forshee <seth.forshee@...onical.com>,
Stéphane Graber <stgraber@...ntu.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Aleksa Sarai <cyphar@...har.com>,
Lennart Poettering <lennart@...ttering.net>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Stephen Barber <smbarber@...omium.org>,
Phil Estes <estesp@...il.com>, Serge Hallyn <serge@...lyn.com>,
Kees Cook <keescook@...omium.org>,
Todd Kjos <tkjos@...gle.com>, Paul Moore <paul@...l-moore.com>,
Jonathan Corbet <corbet@....net>,
Linux Containers <containers@...ts.linux-foundation.org>,
linux-security-module <linux-security-module@...r.kernel.org>,
Linux API <linux-api@...r.kernel.org>,
Ext4 Developers List <linux-ext4@...r.kernel.org>,
linux-xfs@...r.kernel.org, linux-integrity@...r.kernel.org,
SElinux list <selinux@...r.kernel.org>,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v5 15/42] fs: add file_user_ns() helper
On Tue, Jan 19, 2021 at 04:05:00PM +0100, Jann Horn wrote:
> On Wed, Jan 13, 2021 at 1:52 AM Christian Brauner
> <christian.brauner@...ntu.com> wrote:
> > Add a simple helper to retrieve the user namespace associated with the
> > vfsmount of a file. Christoph correctly points out that this makes
> > codepaths (e.g. ioctls) way easier to follow that would otherwise
> > dereference via mnt_user_ns(file->f_path.mnt).
> >
> > In order to make file_user_ns() static inline we'd need to include
> > mount.h in either file.h or fs.h which seems undesirable so let's simply
> > not force file_user_ns() to be inline.
> [...]
> > +struct user_namespace *file_user_ns(struct file *file)
> > +{
> > + return mnt_user_ns(file->f_path.mnt);
> > +}
>
> That name is confusing to me, because when I think of "the userns of a
> file", it's file->f_cred->user_ns. There are a bunch of places that
> look at that, as you can see from grepping for "f_cred->user_ns".
>
> If you really want this to be a separate helper, can you maybe give it
> a clearer name? file_mnt_user_ns(), or something like that, idk.
Done.
Powered by blists - more mailing lists