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: <20250520051600.1903319-4-kent.overstreet@linux.dev>
Date: Tue, 20 May 2025 01:15:55 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: linux-fsdevel@...r.kernel.org,
	linux-bcachefs@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-unionfs@...r.kernel.org
Cc: Kent Overstreet <kent.overstreet@...ux.dev>,
	Miklos Szeredi <miklos@...redi.hu>,
	Amir Goldstein <amir73il@...il.com>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	Christian Brauner <brauner@...nel.org>,
	Jan Kara <jack@...e.cz>
Subject: [PATCH 3/6] fs: SB_CASEFOLD

Add a new flag indicating that a filesystem supports casefolding.

This is better than overlayfs's current method of checking for
sb->s_encoding, which isn't reliable - XFS implements ASCII casefolding,
so it won't be set there.

It's needed for overlayfs and the new dcache exclusion code to check
"should we allow union mounts on this filesystem even though the dcache
hash/compare ops are set? and do we need the new exclusion?".

Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: Christian Brauner <brauner@...nel.org>
Cc: Jan Kara <jack@...e.cz>
Signed-off-by: Kent Overstreet <kent.overstreet@...ux.dev>
---
 fs/libfs.c         | 1 +
 include/linux/fs.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/fs/libfs.c b/fs/libfs.c
index 6393d7c49ee6..d9f6ed6ec4ea 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1952,6 +1952,7 @@ void generic_set_sb_d_ops(struct super_block *sb)
 {
 #if IS_ENABLED(CONFIG_UNICODE)
 	if (sb->s_encoding) {
+		sb->s_flags |= SB_CASEFOLD;
 		sb->s_d_op = &generic_ci_dentry_ops;
 		return;
 	}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 016b0fe1536e..ba942cd2fea1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1228,6 +1228,7 @@ extern int send_sigurg(struct file *file);
 #define SB_SYNCHRONOUS  BIT(4)	/* Writes are synced at once */
 #define SB_MANDLOCK     BIT(6)	/* Allow mandatory locks on an FS */
 #define SB_DIRSYNC      BIT(7)	/* Directory modifications are synchronous */
+#define SB_CASEFOLD	BIT(8)	/* Superblock supports casefolding */
 #define SB_NOATIME      BIT(10)	/* Do not update access times. */
 #define SB_NODIRATIME   BIT(11)	/* Do not update directory access times */
 #define SB_SILENT       BIT(15)
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ