Page MenuHomeFreeBSD

geom: don't write stack garbage in disk labels
ClosedPublic

Authored by asomers on Feb 2 2018, 5:32 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 2, 9:41 PM
Unknown Object (File)
Tue, Jul 2, 9:41 PM
Unknown Object (File)
Tue, Jul 2, 9:41 PM
Unknown Object (File)
Tue, Jul 2, 9:41 PM
Unknown Object (File)
Tue, Jul 2, 8:44 AM
Unknown Object (File)
Wed, Jun 26, 9:52 AM
Unknown Object (File)
Jun 1 2024, 6:55 AM
Unknown Object (File)
May 16 2024, 1:44 AM
Subscribers

Details

Summary

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. Be
more careful to only pass in the true size of the label.

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

Test Plan

existing geom tests

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 14735
Build 14856: arc lint + arc unit

Event Timeline

How sure are we that none of these routines are accessing sector past the relevant struct size? Without investigating that, I'd be more comfortable with the lesser change that just zeroed the sector arrays.

sbin/geom/class/label/geom_label.c
148

this comment can probably be killed?

Zero the sectors the brute force way, without relying on any specific behavior of g_metadata_store

This revision is now accepted and ready to land.Feb 4 2018, 5:59 AM
This revision was automatically updated to reflect the committed changes.