Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2383248pxb; Sun, 15 Nov 2020 02:43:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjWOKNGHukg5jl0YbzTRAVyn/M8+8ss5DxI/gKYzpH3hGlxBl92uAz4Ba0KXVpsNyUzKb7 X-Received: by 2002:aa7:d591:: with SMTP id r17mr11284910edq.274.1605437005059; Sun, 15 Nov 2020 02:43:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605437005; cv=none; d=google.com; s=arc-20160816; b=Q1GIwKSZuyaI+wCvF5ZLzTPh7n3iiZQEPsF0jWPj4kh74srZXiCtfAmk6Qa+fYycY5 v9EuHbkV4ybDMcRxpqjGkMIfFxnrMRjmhHLWyw/GS2KXkZTsHjori9K26OdOUsCzdUCv xSe1w6OL/aWUJ7GEvDG5pc/MbEIEFMcqep5gSeEeIGORY3ORIxZNmV2UByLgbesxs+3V L7x04lQ5vjiVLmchmyb39FapZP9sM8MSIc+9eIJ43rHuEoS+kP9fKqxbZWxY5IthuRAs 9A5ECG+Zspz0PBI30NAO9iZZ/h4J3Vbhm9h7yhXZCzJZGGBFrF6bH4WmfdP1uCwGYjsA TEcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=epgkI+zwP/cCNjnNw2fP0C0Dz/tG3CvoWX9ZI3PkfUo=; b=MifW++vUBGPBCfIp24p1u/pkS6Nl+WGC1Fsh3Upwnzys7CDVBflMvdxGCGtdF2w4BN a6fEg1XgM4r3dm2iC8WQu0KIyboJeFDM/RV7PKs72kXryR3Abk1N4y6lU8V3/e4Al5He 8+nTzsZaLf4YIw7t2O2GUfkLNJJiBxz1Z/tsaMBoFO6GYXYyW4nDlHivMKtMO4uVL7D+ CPfVVnslZawOQtAWn8KsaPCGqH+Kta4V9nDsRrJw14Ywivq0+r0TJpnrkNtHQ4Ectabe J4XfrcoikCdFVb809aIiDEjEhhFqXlipCcGVUe2e+BrXfcwfpk6BZINEssz77W38A+lf ZzsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k30si10007799edj.161.2020.11.15.02.43.02; Sun, 15 Nov 2020 02:43:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726779AbgKOKmq (ORCPT + 99 others); Sun, 15 Nov 2020 05:42:46 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:59336 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbgKOKmK (ORCPT ); Sun, 15 Nov 2020 05:42:10 -0500 Received: from ip5f5af0a0.dynamic.kabel-deutschland.de ([95.90.240.160] 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 1keFS1-0000Kt-Dq; Sun, 15 Nov 2020 10:40:05 +0000 From: Christian Brauner To: Alexander Viro , Christoph Hellwig , linux-fsdevel@vger.kernel.org Cc: John Johansen , James Morris , Mimi Zohar , Dmitry Kasatkin , Stephen Smalley , Casey Schaufler , Arnd Bergmann , Andreas Dilger , OGAWA Hirofumi , Geoffrey Thomas , Mrunal Patel , Josh Triplett , Andy Lutomirski , Theodore Tso , Alban Crequy , Tycho Andersen , David Howells , James Bottomley , Jann Horn , Seth Forshee , =?UTF-8?q?St=C3=A9phane=20Graber?= , Aleksa Sarai , Lennart Poettering , "Eric W. Biederman" , smbarber@chromium.org, Phil Estes , Serge Hallyn , Kees Cook , Todd Kjos , Jonathan Corbet , containers@lists.linux-foundation.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org, linux-ext4@vger.kernel.org, linux-audit@redhat.com, linux-integrity@vger.kernel.org, selinux@vger.kernel.org, Christian Brauner , Christoph Hellwig Subject: [PATCH v2 36/39] overlayfs: do not mount on top of idmapped mounts Date: Sun, 15 Nov 2020 11:37:15 +0100 Message-Id: <20201115103718.298186-37-christian.brauner@ubuntu.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115103718.298186-1-christian.brauner@ubuntu.com> References: <20201115103718.298186-1-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Prevent overlayfs from being mounted on top of idmapped mounts until we have ported it to handle this case and added proper testing for it. Cc: Christoph Hellwig Cc: David Howells Cc: Al Viro Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Christian Brauner --- /* v2 */ patch introduced --- fs/overlayfs/super.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 0d4f2baf6836..3cacc3d3fb65 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1708,6 +1708,12 @@ static struct ovl_entry *ovl_get_lowerstack(struct super_block *sb, if (err) goto out_err; + if (mnt_idmapped(stack[i].mnt)) { + err = -EINVAL; + pr_err("idmapped lower layers are currently unsupported\n"); + goto out_err; + } + lower = strchr(lower, '\0') + 1; } @@ -1939,6 +1945,12 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) if (err) goto out_err; + if (mnt_idmapped(upperpath.mnt)) { + err = -EINVAL; + pr_err("idmapped lower layers are currently unsupported\n"); + goto out_err; + } + err = ovl_get_workdir(sb, ofs, &upperpath); if (err) goto out_err; -- 2.29.2