From 64fcbdc15e2ba52311fb313b28ec50629680d94e Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 5 Mar 2026 15:39:10 -0800 Subject: [PATCH 1/2] Zero out dirent padding to avoid leaking to disk. This allocation here currently leaks through __pad[7] which is written to disk. Use the initializer to enforce zeroing the pad. The name member is written right after. Signed-off-by: Auke Kok --- kmod/src/dir.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kmod/src/dir.c b/kmod/src/dir.c index d2343e58..efcdef24 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -587,10 +587,12 @@ static int add_entry_items(struct super_block *sb, u64 dir_ino, u64 hash, } /* initialize the dent */ - dent->ino = cpu_to_le64(ino); - dent->hash = cpu_to_le64(hash); - dent->pos = cpu_to_le64(pos); - dent->type = mode_to_type(mode); + *dent = (struct scoutfs_dirent) { + .ino = cpu_to_le64(ino), + .hash = cpu_to_le64(hash), + .pos = cpu_to_le64(pos), + .type = mode_to_type(mode), + }; memcpy(dent->name, name, name_len); init_dirent_key(&ent_key, SCOUTFS_DIRENT_TYPE, dir_ino, hash, pos); From 137abc1fe24e7036ada3218d67f5aa311278fd77 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 5 Mar 2026 15:40:21 -0800 Subject: [PATCH 2/2] Zero scoutfs_data_extent_val padding. The initialization here avoids clearing __pad[], which leaks to disk. Use a struct initializer to avoid it. Signed-off-by: Auke Kok --- kmod/src/data.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kmod/src/data.c b/kmod/src/data.c index 7903e8d7..e0d6ccd8 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -79,8 +79,10 @@ static void item_from_extent(struct scoutfs_key *key, .skdx_end = cpu_to_le64(start + len - 1), .skdx_len = cpu_to_le64(len), }; - dv->blkno = cpu_to_le64(map); - dv->flags = flags; + *dv = (struct scoutfs_data_extent_val) { + .blkno = cpu_to_le64(map), + .flags = flags, + }; } static void ext_from_item(struct scoutfs_extent *ext,