aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/pseudofs
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2018-11-23 22:24:59 +0000
committerMark Johnston <markj@FreeBSD.org>2018-11-23 22:24:59 +0000
commit6d2e2df764199f0a15fd743e79599391959cc17d (patch)
tree94c64c4287d31c089acdf8d21713fdc093e76fe5 /sys/fs/pseudofs
parent759436eb7cfdf0ec9de311e6d3dec58a7517faa6 (diff)
downloadsrc-6d2e2df764199f0a15fd743e79599391959cc17d.tar.gz
src-6d2e2df764199f0a15fd743e79599391959cc17d.zip
Ensure that directory entry padding bytes are zeroed.
Directory entries must be padded to maintain alignment; in many filesystems the padding was not initialized, resulting in stack memory being copied out to userspace. With the ino64 work there are also some explicit pad fields in struct dirent. Add a subroutine to clear these bytes and use it in the in-tree filesystems. The NFS client is omitted for now as it was fixed separately in r340787. Reported by: Thomas Barabosch, Fraunhofer FKIE Reviewed by: kib MFC after: 3 days Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/head/; revision=340856
Diffstat (limited to 'sys/fs/pseudofs')
-rw-r--r--sys/fs/pseudofs/pseudofs_vnops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/fs/pseudofs/pseudofs_vnops.c b/sys/fs/pseudofs/pseudofs_vnops.c
index 9f918c103d87..b58791fd75eb 100644
--- a/sys/fs/pseudofs/pseudofs_vnops.c
+++ b/sys/fs/pseudofs/pseudofs_vnops.c
@@ -828,7 +828,6 @@ pfs_readdir(struct vop_readdir_args *va)
/* PFS_DELEN was picked to fit PFS_NAMLEN */
for (i = 0; i < PFS_NAMELEN - 1 && pn->pn_name[i] != '\0'; ++i)
pfsent->entry.d_name[i] = pn->pn_name[i];
- pfsent->entry.d_name[i] = 0;
pfsent->entry.d_namlen = i;
/* NOTE: d_off is the offset of the *next* entry. */
pfsent->entry.d_off = offset + PFS_DELEN;
@@ -855,6 +854,7 @@ pfs_readdir(struct vop_readdir_args *va)
panic("%s has unexpected node type: %d", pn->pn_name, pn->pn_type);
}
PFS_TRACE(("%s", pfsent->entry.d_name));
+ dirent_terminate(&pfsent->entry);
STAILQ_INSERT_TAIL(&lst, pfsent, link);
offset += PFS_DELEN;
resid -= PFS_DELEN;