]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
geom: don't write stack garbage in disk labels
authorasomers <asomers@FreeBSD.org>
Sun, 4 Feb 2018 14:49:55 +0000 (14:49 +0000)
committerasomers <asomers@FreeBSD.org>
Sun, 4 Feb 2018 14:49:55 +0000 (14:49 +0000)
commit330d9b337ff4d1ce14fa226f67286cfb04867837
treecc6486cf8b057ab5af16a6d048aa58e09d11dcd8
parent390b1fd6562bd9eaad72c671bcf442c5a6eb1eb6
geom: don't write stack garbage in disk labels

Most consumers of g_metadata_store were passing in partially unallocated
memory, resulting in stack garbage being written to disk labels. Fix them by
zeroing the memory first.

gvirstor repeated the same mistake, but in the kernel.

Also, glabel's label contained a fixed-size string that wasn't
initialized to zero.

PR: 222077
Reported by: Maxim Khitrov <max@mxcrypt.com>
Reviewed by: cem
MFC after: 3 weeks
X-MFC-With: 323314
X-MFC-With: 323338
Differential Revision: https://reviews.freebsd.org/D14164
sbin/geom/class/cache/geom_cache.c
sbin/geom/class/concat/geom_concat.c
sbin/geom/class/journal/geom_journal.c
sbin/geom/class/label/geom_label.c
sbin/geom/class/mirror/geom_mirror.c
sbin/geom/class/raid3/geom_raid3.c
sbin/geom/class/shsec/geom_shsec.c
sbin/geom/class/stripe/geom_stripe.c
sbin/geom/misc/subr.c
sys/geom/virstor/g_virstor.c