HomeFreeBSD

gmirror: Zero the metadata block before writing

Description

gmirror: Zero the metadata block before writing

The mirror metadata fields contain string buffers and pad bytes, neither
were being zeroed before metadata was written to disk. Also, the
metadata structure is smaller than the sector size, and in one case
gmirror was failing to zero-fill the full buffer before writing.

Fix these problems by pre-zeroing the metadata structure and the sector
buffer.

Reported by: KMSAN
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

Details

Provenance
markjAuthored on Jul 13 2021, 9:45 PM
Parents
rGb9ca419a21d1: fifo: Explicitly initialize generation numbers when opening
Branches
Unknown
Tags
Unknown