[RFC PATCH v2 16/41] ecryptfs: hash daemons by kuid_hash()

Jan Koester jan.koester at tuxist.de
Wed Oct 21 03:15:36 UTC 2026


The daemon hash uses from_kuid(&init_user_ns, euid), which puts all UUID
and GUID users into one bucket. Lookups compare the kuid, so this only
costs time; use kuid_hash().

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: Jan Koester <jan.koester at tuxist.de>
---
 fs/ecryptfs/messaging.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c
index 73c7b8215e..4e2524f786 100644
--- a/fs/ecryptfs/messaging.c
+++ b/fs/ecryptfs/messaging.c
@@ -21,7 +21,7 @@ static struct hlist_head *ecryptfs_daemon_hash;
 DEFINE_MUTEX(ecryptfs_daemon_hash_mux);
 static int ecryptfs_hash_bits;
 #define ecryptfs_current_euid_hash(uid) \
-	hash_long((unsigned long)from_kuid(&init_user_ns, current_euid()), ecryptfs_hash_bits)
+	hash_long((unsigned long)kuid_hash(current_euid()), ecryptfs_hash_bits)
 
 static u32 ecryptfs_msg_counter;
 static struct ecryptfs_msg_ctx *ecryptfs_msg_ctx_arr;
-- 
2.56.0




More information about the Linux-security-module-archive mailing list