]> git.proxmox.com Git - mirror_zfs.git/commit
make zdb_decompress_block check decompression reliably
authorKent Ross <k@mad.cash>
Tue, 9 Jan 2024 17:13:52 +0000 (09:13 -0800)
committerGitHub <noreply@github.com>
Tue, 9 Jan 2024 17:13:52 +0000 (09:13 -0800)
commit7ecaa0758005a56fa579c87a84a2a25ccd61033e
tree6202eaceaee2a0ff167c8c576c0121287c7a741e
parentbd3f90c0c1db570aeebda52c3413662863f9129e
make zdb_decompress_block check decompression reliably

This function decompresses to two buffers and then compares them to
check whether the (opaque) decompression process filled the whole
buffer. Previously it began with lbuf uninitialized and lbuf2 filled
with pseudorandom data. This neither guarantees that any bytes not
written by the compressor would be different, nor seems incredibly
sound otherwise!

After these changes, instead of filling one buffer with generated
pseudorandom data we overwrite each buffer with completely different
data. This should remove the possibility of low-probability failures,
as well as make the process simpler and cheaper.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Kent Ross <k@mad.cash>
Closes #15733
cmd/zdb/zdb.c