FAILED: patch "[PATCH] ovl: reject different lower idmaps on the same fs" failed to apply to 6.1-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 720f40c05b2785406121da0151543751204f2953
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026112500-shrivel-harmony-7572@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 720f40c05b2785406121da0151543751204f2953 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Jean?= <[email protected]>
Date: Wed, 11 Nov 2026 22:42:26 +0000
Subject: [PATCH] ovl: reject different lower idmaps on the same fs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Overayfs mounted with index=on or nfs_export=on require file handle support from backing filesystems.
Overlay file handles identify a backing filesystem, but not the lower mount used to decode it. If lower layers share a superblock and use different idmaps, a handle can decode through the wrong layer.
Record the first idmap on a private lower clone for each backing filesystem. Fail if another clone has a different idmap. Comparing the private clones prevents mount_setattr() from changing the checked state. Distinct idmap objects are treated as ambiguous.
fs/overlayfs/ovl_entry.h +2 -0
@@ -24,6 +24,8 @@ struct ovl_config {struct ovl_sb {struct super_block *sb;dev_t pseudo_dev; +/* Idmap of the first lower layer on this fs */ +const struct mnt_idmap *lower_idmap;/* Unusable (conflicting) uuid */ bool bad_uuid;/* Used as a lower layer (but maybe also as upper) */
fs/overlayfs/super.c +23 -0
@@ -1143,6 +1143,29 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs,return err; } +/* +* Lower file handles identify the lower fs, but not the layer, +* so with different idmaps on the same lower fs, index and +* nfs_export may decode a file handle through a layer with the +* wrong idmap. Following copy up origin without index is only +* used for st_ino, which does not depend on the idmap. +*/ +if (i < nr_merged_lower && + (ofs->config.index || ofs->config.nfs_export)) { +const struct mnt_idmap *idmap =mnt_idmap (mnt); +struct ovl_sb *fs = &ofs->fs[fsid]; + +if (!fs->lower_idmap) { + fs->lower_idmap = idmap; + }else if (fs->lower_idmap != idmap) { +pr_err ("lower layer '%pd2' conflicts with idmap of another lower layer on the same fs, mount with '-o index=off,nfs_export=off' to override.\n" , + l->path.dentry); +iput (trap); +kern_unmount (mnt); +return -EINVAL ; + } + } +/* * Make lower layers R/O. That way fchmod/fchown on lower file * will fail instead of modifying lower fs.
Sasha Levin
maintainerPATCH 1/1 ovl: reject different lower idmaps on the same fs
From: Jérémy Jean <[email protected]>
[ Upstream commit 720f40c05b2785406121da0151543751204f2953 ]
Overayfs mounted with index=on or nfs_export=on require file handle support from backing filesystems.
Overlay file handles identify a backing filesystem, but not the lower mount used to decode it. If lower layers share a superblock and use different idmaps, a handle can decode through the wrong layer.
Record the first idmap on a private lower clone for each backing filesystem. Fail if another clone has a different idmap. Comparing the private clones prevents mount_setattr() from changing the checked state. Distinct idmap objects are treated as ambiguous.
--- fs/overlayfs/ovl_entry.h | 2 ++ fs/overlayfs/super.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+)
fs/overlayfs/ovl_entry.h +2 -0
@@ -25,6 +25,8 @@ struct ovl_config {struct ovl_sb {struct super_block *sb;dev_t pseudo_dev; +/* Idmap of the first lower layer on this fs */ +const struct user_namespace *lower_idmap;/* Unusable (conflicting) uuid */ bool bad_uuid;/* Used as a lower layer (but maybe also as upper) */
fs/overlayfs/super.c +22 -0
@@ -1769,6 +1769,28 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs, goto out; } +/* +* Lower file handles identify the lower fs, but not the layer, +* so with different idmaps on the same lower fs, index and +* nfs_export may decode a file handle through a layer with the +* wrong idmap. Following copy up origin without index is only +* used for st_ino, which does not depend on the idmap. +*/ +if (ofs->config.index || ofs->config.nfs_export) { +const struct user_namespace *idmap =mnt_user_ns (mnt); +struct ovl_sb *fs = &ofs->fs[fsid]; + +if (!fs->lower_idmap) { + fs->lower_idmap = idmap; + }else if (fs->lower_idmap != idmap) { +pr_err ("lower layer '%pd2' conflicts with idmap of another lower layer on the same fs, mount with '-o index=off,nfs_export=off' to override.\n" , + stack[i].dentry); +iput (trap); +kern_unmount (mnt); +return -EINVAL ; + } + } +/* * Make lower layers R/O. That way fchmod/fchown on lower file * will fail instead of modifying lower fs.
Signature · 1 line
2.53.0