[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOQ4uxit1W2SRzMs+yUeUodVxPa-YVKimmzBE=nMxeL5G8j2eA@mail.gmail.com>
Date: Wed, 15 Oct 2025 12:52:05 +0200
From: Amir Goldstein <amir73il@...il.com>
To: André Almeida <andrealmeid@...lia.com>
Cc: linux-kernel@...r.kernel.org, linux-btrfs@...r.kernel.org,
linux-unionfs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
kernel-dev@...lia.com, Miklos Szeredi <miklos@...redi.hu>, Chris Mason <clm@...com>,
David Sterba <dsterba@...e.com>, Anand Jain <anand.jain@...cle.com>,
"Guilherme G . Piccoli" <gpiccoli@...lia.com>
Subject: Re: [RFC PATCH 1/1] ovl: Use fsid as unique identifier for trusted origin
On Tue, Oct 14, 2025 at 3:57 AM André Almeida <andrealmeid@...lia.com> wrote:
>
> Some filesystem have non-persistent UUIDs, that can change between
> mounting, even if the filesystem is not modified. To prevent
> false-positives when mounting overlayfs with index enabled, use the fsid
> reported from statfs that is persistent across mounts.
>
> Signed-off-by: André Almeida <andrealmeid@...lia.com>
> ---
> This patch is just for illustrative purposes and doesn't work.
> ---
> fs/overlayfs/copy_up.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
> index aac7e34f56c1..633d9470a089 100644
> --- a/fs/overlayfs/copy_up.c
> +++ b/fs/overlayfs/copy_up.c
> @@ -8,6 +8,7 @@
> #include <linux/fs.h>
> #include <linux/slab.h>
> #include <linux/file.h>
> +#include <linux/statfs.h>
> #include <linux/fileattr.h>
> #include <linux/splice.h>
> #include <linux/xattr.h>
> @@ -421,9 +422,14 @@ struct ovl_fh *ovl_encode_real_fh(struct ovl_fs *ofs, struct inode *realinode,
> struct ovl_fh *fh;
> int fh_type, dwords;
> int buflen = MAX_HANDLE_SZ;
> - uuid_t *uuid = &realinode->i_sb->s_uuid;
> + uuid_t uuid;
> + struct kstatfs ks;
> int err;
>
> + // RFC: dentry can't be NULL, uuid needs a type cast
> + realinode->i_sb->s_op->statfs(NULL, &ks);
> + uuid.b = ks.f_fsid;
> +
Just wanted to add that from overlayfs POV, this is completely wrong,
because there are many fs whose fsid is not persistent including the
default fs that are used in many distros and the whole idea of the
origin xattr value is that it needs to be a persistent descriptor of the
lower layer directory.
Thanks,
Amir.
Powered by blists - more mailing lists