($INBOX_DIR/description missing)
 help / color / Atom feed
* [PATCH] ovl: fix regression with re-formatted lower squashfs
@ 2020-07-08 13:16 Amir Goldstein
  2020-07-14 14:27 ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: Amir Goldstein @ 2020-07-08 13:16 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: Fabian, linux-unionfs

Commit 9df085f3c9a2 ("ovl: relax requirement for non null uuid of lower
fs") relaxed the requirement for non null uuid with single lower layer to
allow enabling index and nfs_export features with single lower squashfs.

Fabian reported a regression in a setup when overlay re-uses an existing
upper layer and re-formats the lower squashfs image.  Because squashfs
has no uuid, the origin xattr in upper layer are decoded from the new
lower layer where they may resolve to a wrong origin file and user may
get an ESTALE or EIO error on lookup.

To avoid the reported regression while still allowing the new features
with single lower squashfs, do not allow decoding origin with lower null
uuid unless user opted-in to one of the new features that require
following the lower inode of non-dir upper (index, xino, metacopy).

Reported-by: Fabian <godi.beat@gmx.net>
Link: https://lore.kernel.org/linux-unionfs/32532923.JtPX5UtSzP@fgdesktop/
Fixes: 9df085f3c9a2 ("ovl: relax requirement for non null uuid...")
Cc: stable@vger.kernel.org # v4.20+
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/overlayfs/super.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 15939ab39c1c..06ec3cb977e6 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -1402,6 +1402,18 @@ static bool ovl_lower_uuid_ok(struct ovl_fs *ofs, const uuid_t *uuid)
 	if (!ofs->config.nfs_export && !ovl_upper_mnt(ofs))
 		return true;
 
+	/*
+	 * We allow using single lower with null uuid for index and nfs_export
+	 * for example to support those features with single lower squashfs.
+	 * To avoid regressions in setups of overlay with re-formatted lower
+	 * squashfs, do not allow decoding origin with lower null uuid unless
+	 * user opted-in to one of the new features that require following the
+	 * lower inode of non-dir upper.
+	 */
+	if (!ofs->config.index && !ofs->config.metacopy && !ofs->config.xino &&
+	    uuid_is_null(uuid))
+		return false;
+
 	for (i = 0; i < ofs->numfs; i++) {
 		/*
 		 * We use uuid to associate an overlay lower file handle with a
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ovl: fix regression with re-formatted lower squashfs
  2020-07-08 13:16 [PATCH] ovl: fix regression with re-formatted lower squashfs Amir Goldstein
@ 2020-07-14 14:27 ` Miklos Szeredi
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2020-07-14 14:27 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: Fabian, overlayfs

On Wed, Jul 8, 2020 at 3:16 PM Amir Goldstein <amir73il@gmail.com> wrote:
>
> Commit 9df085f3c9a2 ("ovl: relax requirement for non null uuid of lower
> fs") relaxed the requirement for non null uuid with single lower layer to
> allow enabling index and nfs_export features with single lower squashfs.
>
> Fabian reported a regression in a setup when overlay re-uses an existing
> upper layer and re-formats the lower squashfs image.  Because squashfs
> has no uuid, the origin xattr in upper layer are decoded from the new
> lower layer where they may resolve to a wrong origin file and user may
> get an ESTALE or EIO error on lookup.
>
> To avoid the reported regression while still allowing the new features
> with single lower squashfs, do not allow decoding origin with lower null
> uuid unless user opted-in to one of the new features that require
> following the lower inode of non-dir upper (index, xino, metacopy).
>
> Reported-by: Fabian <godi.beat@gmx.net>
> Link: https://lore.kernel.org/linux-unionfs/32532923.JtPX5UtSzP@fgdesktop/
> Fixes: 9df085f3c9a2 ("ovl: relax requirement for non null uuid...")
> Cc: stable@vger.kernel.org # v4.20+
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>


Thanks, applied.

Miklos

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08 13:16 [PATCH] ovl: fix regression with re-formatted lower squashfs Amir Goldstein
2020-07-14 14:27 ` Miklos Szeredi

($INBOX_DIR/description missing)

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-unionfs/0 linux-unionfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-unionfs linux-unionfs/ https://lore.kernel.org/linux-unionfs \
		linux-unionfs@vger.kernel.org
	public-inbox-index linux-unionfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-unionfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git