aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/geom/misc
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2017-09-08 15:08:17 +0000
committerConrad Meyer <cem@FreeBSD.org>2017-09-08 15:08:17 +0000
commit0bd816f2110f08a6333c046f119e65ccab1c505b (patch)
tree3a08fc445c6609e109163fb086efa3a77cd03442 /sbin/geom/misc
parentdc63dc00cbf037902c5bb481aad98a07b5489e2f (diff)
downloadsrc-0bd816f2110f08a6333c046f119e65ccab1c505b.tar.gz
src-0bd816f2110f08a6333c046f119e65ccab1c505b.zip
Audit userspace geom code for leaking memory to disk
Any geom class using g_metadata_store, as well as geom_virstor which duplicated g_metadata_store internally, would dump sectorsize - mdsize bytes of userspace memory following the metadata block stored. This is most or all geom classes (gcache, gconcat, geli, gjournal, glabel, gmirror, gmultipath, graid3, gshsec, gstripe, and geom_virstor). PR: 222077 (comment #3) Reported by: Maxim Khitrov <max AT mxcrypt.com> Reviewed by: des Security: yes Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12269
Notes
Notes: svn path=/head/; revision=323314
Diffstat (limited to 'sbin/geom/misc')
-rw-r--r--sbin/geom/misc/subr.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sbin/geom/misc/subr.c b/sbin/geom/misc/subr.c
index cf0d9b00cf85..5f5ca9115bc6 100644
--- a/sbin/geom/misc/subr.c
+++ b/sbin/geom/misc/subr.c
@@ -302,6 +302,7 @@ g_metadata_store(const char *name, const unsigned char *md, size_t size)
goto out;
}
bcopy(md, sector, size);
+ bzero(sector + size, sectorsize - size);
if (pwrite(fd, sector, sectorsize, mediasize - sectorsize) !=
sectorsize) {
error = errno;