lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251014015707.129013-2-andrealmeid@igalia.com>
Date: Mon, 13 Oct 2025 22:57:07 -0300
From: André Almeida <andrealmeid@...lia.com>
To: linux-kernel@...r.kernel.org,
	linux-btrfs@...r.kernel.org,
	linux-unionfs@...r.kernel.org,
	linux-fsdevel@...r.kernel.org
Cc: kernel-dev@...lia.com,
	Miklos Szeredi <miklos@...redi.hu>,
	Amir Goldstein <amir73il@...il.com>,
	Chris Mason <clm@...com>,
	David Sterba <dsterba@...e.com>,
	Anand Jain <anand.jain@...cle.com>,
	"Guilherme G . Piccoli" <gpiccoli@...lia.com>,
	André Almeida <andrealmeid@...lia.com>
Subject: [RFC PATCH 1/1] ovl: Use fsid as unique identifier for trusted origin

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;
+
 	/* Make sure the real fid stays 32bit aligned */
 	BUILD_BUG_ON(OVL_FH_FID_OFFSET % 4);
 	BUILD_BUG_ON(MAX_HANDLE_SZ + OVL_FH_FID_OFFSET > 255);
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ