]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r323314, r323338, r328849
authorasomers <asomers@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 10 Mar 2018 04:17:01 +0000 (04:17 +0000)
committerasomers <asomers@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 10 Mar 2018 04:17:01 +0000 (04:17 +0000)
commitd9fca828bfdadcb197f3d8b126d6ab5eb90307dd
tree566bcbbd19b2a63d928d78a34ea7d37b7b0b4cad
parent31456d77f2297ead57b4d90ad16a2c1cc0e5a5a6
MFC r323314, r323338, r328849

r323314:
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

r323338:
Fix information leak in geli(8) integrity mode

In integrity mode, a larger logical sector (e.g., 4096 bytes) spans several
physical sectors (e.g., 512 bytes) on the backing device.  Due to hash
overhead, a 4096 byte logical sector takes 8.5625 512-byte physical sectors.
This means that only 288 bytes (256 data + 32 hash) of the last 512 byte
sector are used.

The memory allocation used to store the encrypted data to be written to the
physical sectors comes from malloc(9) and does not use M_ZERO.

Previously, nothing initialized the final physical sector backing each
logical sector, aside from the hash + encrypted data portion.  So 224 bytes
of kernel heap memory was leaked to every block :-(.

This patch addresses the issue by initializing the trailing portion of the
physical sector in every logical sector to zeros before use.  A much simpler
but higher overhead fix would be to tag the entire allocation M_ZERO.

PR: 222077
Reported by: Maxim Khitrov <max AT mxcrypt.com>
Reviewed by: emaste
Security: yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12272

r328849:
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
X-MFC-With: 323314
X-MFC-With: 323338
Differential Revision: https://reviews.freebsd.org/D14164

git-svn-id: svn://svn.freebsd.org/base/stable/10@330737 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
12 files changed:
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/class/virstor/geom_virstor.c
sbin/geom/misc/subr.c
sys/geom/eli/g_eli_integrity.c
sys/geom/virstor/g_virstor.c