.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Podwrapper::Man 1.38.2 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "nbdkit-evil-filter 1" .TH nbdkit-evil-filter 1 2024-05-10 nbdkit-1.38.2 NBDKIT .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME nbdkit\-evil\-filter \- add random data corruption to reads .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 4 \& nbdkit \-\-filter=evil PLUGIN [PLUGIN\-ARGS...] \& evil=[cosmic\-rays|stuck\-bits|stuck\-wires] \& [evil\-probability=PROB] [evil\-stuck\-probability=PROB] \& [evil\-seed=SEED] .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" nbdkit-evil-filter is a Byzantine filter for \fBnbdkit\fR\|(1) that randomly corrupts data when reading from the underlying plugin. This can be used for testing filesystem checksums. Note that it does not change write operations, so the underlying plugin contains the correct data. .PP \&\fBnbdkit\-error\-filter\fR\|(1) is a related filter that injects hard errors into the NBD protocol. .PP This filter has several modes, controlled using the \f(CW\*(C`evil=...\*(C'\fR parameter. These are: .ie n .IP """evil=cosmic\-rays""" 4 .el .IP \f(CWevil=cosmic\-rays\fR 4 .IX Item "evil=cosmic-rays" Bits are flipped at random when reading data. The probability that a bit is flipped is controlled using the \f(CW\*(C`evil\-probability\*(C'\fR parameter, defaulting to 1e\-8 (on average 1 in every 100 million bits read is flipped). .ie n .IP """evil=stuck\-bits""" 4 .el .IP \f(CWevil=stuck\-bits\fR 4 .IX Item "evil=stuck-bits" This is the default mode. .Sp Fixed bits in the backing file are stuck randomly high or low. The \&\f(CW\*(C`evil\-probability\*(C'\fR parameter controls the expected probability that a particular bit is stuck, defaulting in this mode to 1e\-8 (1 in 100 million). \f(CW\*(C`evil\-stuck\-probability\*(C'\fR controls the probability that a stuck bit is read as its stuck value or its correct value, defaulting to 100% (always read as a stuck bit). .ie n .IP """evil=stuck\-wires""" 4 .el .IP \f(CWevil=stuck\-wires\fR 4 .IX Item "evil=stuck-wires" This is similar to \f(CW\*(C`stuck\-bits\*(C'\fR but instead of simulating bad backing data, it simulates stuck wires along the data path (eg. in a register). The difference is that when reading, the stuck bit always happens at the same position in the packet of data being read, regardless of where on the underlying disk it is being read from. \&\f(CW\*(C`evil\-probability\*(C'\fR controls the probability of a stuck wire, defaulting in this mode to 1e\-6 (1 in 1 million). \&\f(CW\*(C`evil\-stuck\-probability\*(C'\fR controls the probability that a stuck bit is read as its stuck value or its correct value, defaulting to 100% (always read as a stuck bit). .SH EXAMPLES .IX Header "EXAMPLES" Add some stuck bits to the backing file at random: .PP .Vb 1 \& nbdkit \-\-filter=evil file disk.img .Ve .PP Cosmic rays will flip (on average) one in every 100 million bits copied from the backing file over NBD: .PP .Vb 2 \& nbdkit \-\-filter=evil file disk.img evil=cosmic\-rays \e \& \-\-run \*(Aqnbdcopy $uri output.img\*(Aq .Ve .SH NOTES .IX Header "NOTES" .SS Extents .IX Subsection "Extents" Plugins can be sparse. This filter only corrupts bits in non-sparse parts of the backing disk and it leaves sparse regions unchanged (which is realistic behaviour). If you wish to use this filter to corrupt sparse regions, then combine this filter with \&\fBnbdkit\-noextents\-filter\fR\|(1). For example: .PP .Vb 1 \& nbdkit \-\-filter=evil \-\-filter=noextents memory 1G .Ve .SS "Probability limited to [ 1e\-12 .. 1/8 ]" .IX Subsection "Probability limited to [ 1e-12 .. 1/8 ]" The current implementation limits probabilities to the range [\ 1e\-12\ ..\ 1/8\ ]. Values below this range are treated the same as 0%. Values above this range are treated the same as 100%. .SH PARAMETERS .IX Header "PARAMETERS" .IP \fBevil=cosmic\-rays\fR 4 .IX Item "evil=cosmic-rays" .PD 0 .IP \fBevil=stuck\-bits\fR 4 .IX Item "evil=stuck-bits" .IP \fBevil=stuck\-wires\fR 4 .IX Item "evil=stuck-wires" .PD Select the mode of evil. See the "DESCRIPTION" above. The default is \f(CW\*(C`stuck\-bits\*(C'\fR. .IP \fBevil\-probability=\fRN 4 .IX Item "evil-probability=N" .PD 0 .IP \fBevil\-probability=\fRN\fB:\fRM 4 .IX Item "evil-probability=N:M" .IP \fBevil\-probability=\fRN\fB%\fR 4 .IX Item "evil-probability=N%" .PD Set the probability for the mode. You can either use a floating point number between 0 and 1, eg. \f(CW\*(C`evil\-probability=0.001\*(C'\fR or \&\f(CW\*(C`evil\-probability=1e\-6\*(C'\fR. Or you can write it as N in M, eg. \&\f(CW\*(C`evil\-probability=1:1000000\*(C'\fR or \f(CW\*(C`evil\-probability=3.33:100000\*(C'\fR. Or you can write this as a percentage, eg. \f(CW\*(C`evil\-probability=1%\*(C'\fR. .Sp The default probability depends on the mode. .IP \fBevil\-seed=\fRSEED 4 .IX Item "evil-seed=SEED" To make runs repeatable, use this to set a seed for the random number generator. Note that runs are repeatable only if you use the same version of nbdkit, since in future we may change the algorithm. .Sp The default is to choose a seed at random. .IP \fBevil\-stuck\-probability=\fRN 4 .IX Item "evil-stuck-probability=N" .PD 0 .IP \fBevil\-stuck\-probability=\fRN\fB:\fRM 4 .IX Item "evil-stuck-probability=N:M" .IP \fBevil\-stuck\-probability=\fRN\fB%\fR 4 .IX Item "evil-stuck-probability=N%" .PD For the "stuck\-*" modes, the probability that when reading a stuck bit you will read the stuck bit or the correct value. This defaults to 1 (ie. 100%) which means the bit is always stuck. Setting it to 0.5 for example will mean that half the time the bit appears stuck and half the time you see the correct value. .SH FILES .IX Header "FILES" .ie n .IP \fR\fI$filterdir\fR\fI/nbdkit\-evil\-filter.so\fR 4 .el .IP \fR\f(CI$filterdir\fR\fI/nbdkit\-evil\-filter.so\fR 4 .IX Item "$filterdir/nbdkit-evil-filter.so" The filter. .Sp Use \f(CW\*(C`nbdkit \-\-dump\-config\*(C'\fR to find the location of \f(CW$filterdir\fR. .SH VERSION .IX Header "VERSION" \&\f(CW\*(C`nbdkit\-evil\-filter\*(C'\fR first appeared in nbdkit 1.36. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBnbdkit\fR\|(1), \&\fBnbdkit\-filter\fR\|(3), \&\fBnbdkit\-delay\-filter\fR\|(1), \&\fBnbdkit\-noextents\-filter\fR\|(1), \&\fBnbdkit\-error\-filter\fR\|(1). .SH AUTHORS .IX Header "AUTHORS" Richard W.M. Jones .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright Red Hat .SH LICENSE .IX Header "LICENSE" Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: .IP \(bu 4 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. .IP \(bu 4 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. .IP \(bu 4 Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. .PP THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.