Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5927545ybv; Tue, 18 Feb 2020 06:37:48 -0800 (PST) X-Google-Smtp-Source: APXvYqxu66HcdE2daaegAUayVqSHGa6hZjID8foal03jKNXMEpXtNHlNChm5c/WohxT/yiS9vc7R X-Received: by 2002:a9d:5e82:: with SMTP id f2mr15349485otl.240.1582036667922; Tue, 18 Feb 2020 06:37:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582036667; cv=none; d=google.com; s=arc-20160816; b=OBXn2RYMSVTmEOrU3AR0K6kJRwltA+XAF6Yx78w7nQe8hIg4U8lT1c8UU2xLIYcTPD vZRVctY/4try0pZxwk1yfXz5j8Tia9cmX8FpDxGkEyPupredCiwoTeHgzkYgyVn4eEJN lg7ihJJBiL4IiKF3kE/S6nQvF0fWxZquBti9uf9HBGjKs3DwCf3MbZ5DCiNXILrU4H3K TxQAirYF78+GcDYazrW6iIICyrU00AKeqLYHVInmGnUxDxsO3wifcw3rm/Uih/pyYXO6 Tg5IC7cusz0q5TlO3TSG9+SlxpcDr0NZTRjG5fWortPzuJKoMFh4s1IY99LIR6lyfVGO EUDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=grhXKzFcBd0NQsSwHfGc78z2L5GKD2MgNwvMk12fwQ8=; b=bJBdl7G6i9Ad7hq4quNUCfb+PY+QQZrYxcLAZn8IQIeOAB1QWK+kcJoesh2ePwh/K8 Ujz4GHth6taEbjNyte5srADneB+Uz9WpA8YFWcfe+71x141nmgyaW0wLir5lToSjuLUA fwR6qV0ikPHAwXLIWEKD25lem5R8R4rMyZSMPJxgjVfOIipWwwpyOHMOaMU5GFU8kplx wTC+GCJCtrAfb8zT9xG3yF+gn2+TJ5JjbfSVstlBAj6BtofxAKVqnG/CkPlPLWyiV4jC hd25fBzEIvCnFQSKkXMkXDCMtTgs0bXbZoTlJvvwqa/o2dskg+AkvX56zy6I1sYtpHXv qydw== 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 q189si7863585oic.235.2020.02.18.06.37.35; Tue, 18 Feb 2020 06:37:47 -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 S1727326AbgBROhI (ORCPT + 99 others); Tue, 18 Feb 2020 09:37:08 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:52967 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726569AbgBROfe (ORCPT ); Tue, 18 Feb 2020 09:35:34 -0500 Received: from ip5f5bf7ec.dynamic.kabel-deutschland.de ([95.91.247.236] helo=wittgenstein.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1j43xx-0000fF-20; Tue, 18 Feb 2020 14:35:13 +0000 From: Christian Brauner To: =?UTF-8?q?St=C3=A9phane=20Graber?= , "Eric W. Biederman" , Aleksa Sarai , Jann Horn Cc: 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, Christian Brauner Subject: [PATCH v3 09/25] fs: add is_userns_visible() helper Date: Tue, 18 Feb 2020 15:33:55 +0100 Message-Id: <20200218143411.2389182-10-christian.brauner@ubuntu.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200218143411.2389182-1-christian.brauner@ubuntu.com> References: <20200218143411.2389182-1-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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