From: "Jérémy Jean" <jeremy.jean@oss.cyber.gouv.fr>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>,
miklos@szeredi.hu, linux-unionfs@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] ovl: disable nfs_export for same-sb lower layers with different idmaps
Date: Sun, 08 Nov 2026 20:12:49 +0100 [thread overview]
Message-ID: <5e8dff576ead72fa502b7cd38889e780@oss.cyber.gouv.fr> (raw)
In-Reply-To: <CAOQ4uxhdP4XeHfbKfOg+3XRF8oLhPMmbU9xHp7pV2w=snQk-+w@mail.gmail.com>
On 2026-09-25 16:17, Amir Goldstein wrote:
> On Fri, Sep 25, 2026 at 3:51 PM Christian Brauner <brauner@kernel.org>
> wrote:
>>
>> On Mon, Sep 21, 2026 at 10:10:28AM +0200, Amir Goldstein wrote:
>> > On Sun, Sep 20, 2026 at 10:33 PM Jérémy Jean
>> > <Jeremy.Jean@oss.cyber.gouv.fr> wrote:
>> > >
>> > > 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 file handle can decode through the wrong layer and
>> > > initialize the overlay inode with the wrong owner.
>> > >
>> > > Track the first lower idmap seen for each ovl_sb and disable nfs_export
>> > > when another lower layer on the same backing superblock uses a different
>> > > idmap. Keep index enabled: copy up starts from the overlay dentry selected
>> > > by lookup and does not need to decode a lower file handle through another
>> > > layer.
>> > >
>> > > Fixes: bc70682a497c ("ovl: support idmapped layers")
>> > > Assisted-by: Codex:gpt-5
>> > > Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
>> > > ---
>> > > fs/overlayfs/ovl_entry.h | 2 ++
>> > > fs/overlayfs/super.c | 28 +++++++++++++++++++++++++++-
>> > > 2 files changed, 29 insertions(+), 1 deletion(-)
>> > >
>> > > diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h
>> > > index 80cad4ea96a3..2a6e12a0d4dd 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 */
>> > > + 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 bd0a3f9039d2..8e78da420b75 100644
>> > > --- a/fs/overlayfs/super.c
>> > > +++ b/fs/overlayfs/super.c
>> > > @@ -944,6 +944,24 @@ static bool ovl_lower_uuid_ok(struct ovl_fs *ofs, const uuid_t *uuid)
>> > > return true;
>> > > }
>> > >
>> > > +/*
>> > > + * Lower file handles identify a lower fs, but not the mount whose idmap was
>> > > + * used to decode them. Remember the first lower idmap seen for each fs so
>> > > + * decodable export handles can be disabled if another one appears.
>>
>> I find this behavior counterintuitive. Shouldn't we just fail the
>> mount then?
>
> I would love to fail the mount if you confirm that setting up an ovl
> with several
> lower layers some on the same fs with different idmap, is a
> non-feature.
>
> I don't know can't /home/amir and /home/brauner be on the same fs with
> different idmapping?
>
> Could it ever make sense to compose an overlay from two such
> directories?
> If not then I would gladly remove this setup from the test matrix.
>
> Thanks,
> Amir.
Hello,
I'm digging this up: should I investigate to prepare a new version that
simply fails the mount? Please tell me what you'd prefer.
Regards,
Jérémy
next prev parent reply other threads:[~2026-11-08 19:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-20 20:32 [PATCH v2 0/3] ovl: disable nfs_export for mixed-idmap same-sb lower layers Jérémy Jean
2026-09-20 20:32 ` [PATCH v2 1/3] ovl: disable nfs_export for same-sb lower layers with different idmaps Jérémy Jean
2026-09-21 8:10 ` Amir Goldstein
2026-09-25 13:51 ` Christian Brauner
2026-09-25 14:17 ` Amir Goldstein
2026-11-08 19:12 ` Jérémy Jean [this message]
2026-09-20 20:32 ` [PATCH v2 2/3] selftests: overlayfs: reject handles for mixed lower idmaps Jérémy Jean
2026-09-21 8:14 ` Amir Goldstein
2026-09-20 20:32 ` [PATCH v2 3/3] selftests: overlayfs: keep index copy up with " Jérémy Jean
2026-09-21 8:18 ` Amir Goldstein
2026-09-21 8:03 ` [PATCH v2 0/3] ovl: disable nfs_export for mixed-idmap same-sb lower layers Amir Goldstein
2026-09-21 8:22 ` Jérémy Jean
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=5e8dff576ead72fa502b7cd38889e780@oss.cyber.gouv.fr \
--to=jeremy.jean@oss.cyber.gouv.fr \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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
all inboxes | Powered by JetHome®