From: <gregkh@linuxfoundation.org>
To: Jeremy.Jean@oss.cyber.gouv.fr,amir73il@gmail.com,brauner@kernel.org
Cc: <stable@vger.kernel.org>
Subject: FAILED: patch "[PATCH] ovl: reject different lower idmaps on the same fs" failed to apply to 6.1-stable tree
Date: Wed, 25 Nov 2026 11:46:00 +0100 [thread overview]
Message-ID: <2026112500-shrivel-harmony-7572@gregkh> (raw)
The 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 <stable@vger.kernel.org>.
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 '<stable@vger.kernel.org>' --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?= <Jeremy.Jean@oss.cyber.gouv.fr>
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.
Fixes: bc70682a497c ("ovl: support idmapped layers")
Suggested-by: Christian Brauner <brauner@kernel.org>
Link: Link: https://lore.kernel.org/all/20260925-server-hager-riskieren-06116eded213@brauner/
Cc: stable@vger.kernel.org
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h
index ac07e8769f9b..5b2f1b930daa 100644
--- a/fs/overlayfs/ovl_entry.h
+++ b/fs/overlayfs/ovl_entry.h
@@ -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) */
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index ad623e392122..e61aab1999d3 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -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.
reply other threads:[~2026-11-25 11:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026112500-shrivel-harmony-7572@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=Jeremy.Jean@oss.cyber.gouv.fr \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox