From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D52B6C3404D for ; Wed, 19 Feb 2020 02:42:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ADC1A206EF for ; Wed, 19 Feb 2020 02:42:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728177AbgBSCmf (ORCPT ); Tue, 18 Feb 2020 21:42:35 -0500 Received: from mail.hallyn.com ([178.63.66.53]:49664 "EHLO mail.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727187AbgBSCmf (ORCPT ); Tue, 18 Feb 2020 21:42:35 -0500 Received: by mail.hallyn.com (Postfix, from userid 1001) id 170EEB83; Tue, 18 Feb 2020 20:42:33 -0600 (CST) Date: Tue, 18 Feb 2020 20:42:33 -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 09/25] fs: add is_userns_visible() helper Message-ID: <20200219024233.GA19334@mail.hallyn.com> References: <20200218143411.2389182-1-christian.brauner@ubuntu.com> <20200218143411.2389182-10-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200218143411.2389182-10-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:55PM +0100, Christian Brauner wrote: > Introduce a helper which makes it possible to detect fileystems whose > superblock is visible in multiple user namespace. This currently only > means proc and sys. Such filesystems usually have special semantics so their > behavior will not be changed with the introduction of fsid mappings. Hi, I'm afraid I've got a bit of a hangup about the terminology here. I *think* what you mean is that SB_I_USERNS_VISIBLE is an fs whose uids are always translated per the id mappings, not fsid mappings. But when I see the name it seems to imply that !SB_I_USERNS_VISIBLE filesystems can't be seen by other namespaces at all. Am I right in my first interpretation? If so, can we talk about the naming? > Signed-off-by: Christian Brauner > --- > /* v2 */ > unchanged > > /* v3 */ > unchanged > --- > include/linux/fs.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 3cd4fe6b845e..fdc8fb2d786b 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -3651,4 +3651,9 @@ static inline int inode_drain_writes(struct inode *inode) > return filemap_write_and_wait(inode->i_mapping); > } > > +static inline bool is_userns_visible(unsigned long iflags) > +{ > + return (iflags & SB_I_USERNS_VISIBLE); > +} > + > #endif /* _LINUX_FS_H */ > -- > 2.25.0