Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2058857ybv; Fri, 14 Feb 2020 10:38:41 -0800 (PST) X-Google-Smtp-Source: APXvYqzUV2MOBpFStStF7nJo29NqQV8b7msQXASvjlb1FCn46QBFpMf63T771OY4ZbpbMhFGqxMT X-Received: by 2002:aca:b483:: with SMTP id d125mr2901244oif.167.1581705521121; Fri, 14 Feb 2020 10:38:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581705521; cv=none; d=google.com; s=arc-20160816; b=LxXDjXof2aaXY36Z5/gAwTgTl7hah/Qa3+6VLPaSucPK2U61DhtRPUaK8DcjSWdGuG 8oapGcSbcHkqKedZNPyRT1T4aE+ec0i++BFNEhO1j45RfNW1zH48bg4I5AF+wJ3H7+vB lTc3eRd3fxDDttppaeFf939aN43FW2X/VTdnZXC1jKy+e86R2aCZQMlNzin9FCs+Jd7h fUedB3Na2RLdDWAVUqLpjRbuyT2r4Es4F/dVOrsjg3PC+3KqBLt8jkDOopIvdG6joy3K 54Al0BeGrnY8R/xI8y2TEl3wD0FYnkZv8cdcSaMJBm431nTRXtEuWMb+fxaiWb16S07X zqfQ== 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=0ouEHerTjBQxnEqiZXH+j5xHIDujhRyV3C8jroxl9H0=; b=T+C/adaQruKbTdbokE8yykifB4x7HgH54BIO81KvLLMsrmKTF0xp6c9SdtPITksxm6 7K1oOJqB31M9y/nrxSaL4SF7hrFxri//2d4LNr590KkgMNpx47JdQhrNuZUx4mxOxinz xyxAofcZcXsvQoQhBbTqVPORsr5bj7UcY4SVqnDy9lf5ciDVed/+KCkDyGtlJeQJRmWy 0RcwVijmWRxHPtF/s7smhCkMNe8P1ussfB+KzZLEcSJJtVC8SLGg8mNSPShoxxvky1gi GxhvbzpJ5yjhXcl907KxXejXd097ftvQBzbADP5aV0px4NF5iWO6onlTCZHt/6zmVEqk /5ng== 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 t137si3300160oif.61.2020.02.14.10.38.28; Fri, 14 Feb 2020 10:38:41 -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 S1730802AbgBNSiM (ORCPT + 99 others); Fri, 14 Feb 2020 13:38:12 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:33734 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730561AbgBNSiK (ORCPT ); Fri, 14 Feb 2020 13:38:10 -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 1j2fqZ-0000uO-2n; Fri, 14 Feb 2020 18:37:51 +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 v2 15/28] fs: add is_userns_visible() helper Date: Fri, 14 Feb 2020 19:35:41 +0100 Message-Id: <20200214183554.1133805-16-christian.brauner@ubuntu.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200214183554.1133805-1-christian.brauner@ubuntu.com> References: <20200214183554.1133805-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 --- 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