Home | History | Annotate | only in /src/tests/dev
History log of /src/tests/dev
RevisionDateAuthorComments
 1.12 14-Aug-2016  jakllsch tests for sys/dev/clock_subr.c
 1.11 29-Jul-2016  pgoyette Add a basic test for fss(4)

XXX For now, we just create required files (including mount-points)
XXX in the test's working directory. Eventually someone with more
XXX rump-foo than I should create a fss rump-component and then update
XXX the test to run under rump.
 1.10 05-Jan-2016  jakllsch branches: 1.10.2;
Add some tests for the kernel HID parser.
 1.9 22-Jun-2015  matt Don't build tests that depend on RUMP if BSD_MK_COMPAT_FILE is defined.
 1.8 08-Aug-2012  christos Exclude tests that use rump
 1.7 15-Dec-2010  pooka branches: 1.7.6;
"A few seconds later" I realized the kernel directory is dev/raidframe,
not dev/raid, so reflect this in the test dir. Affects location
for test of PR kern/44239.
 1.6 15-Dec-2010  pooka Add first raidframe tests. This is the test for the kernel fault
described in PR kern/44239
 1.5 23-Nov-2010  pooka Add simple test for md(4) which just stuffs junk into /dev/rmd0d
and checks the same data can be retrieved.
 1.4 11-Nov-2010  pooka Add rudimentary cgd tests. The tests use cgd to transform a
plaintext into into an encrypted image and back into plaintext by
doing rump I/O on /dev/cgd. There is one test to check that giving
the same password for both encryption and decryption produces the
same plaintext and another to check that giving a different passwords
does not produce the same plaintext.

This could be fairly easily extended to test all feature of cgd
(hint hint). For example, now cgd.conf is included in cvs, but
the only reason for that is that without further hacking cgdconfig
uses /dev/random quality random to generate the salt for a
pkcsetcetc_kdf2 cgconfig -g, and making an automated test block on
the entropy pool is just not good form. Details are everything.
 1.3 24-Aug-2010  pooka Test for cache sync noises after disk is ejected.

test case for PR kern/43785
 1.2 06-Aug-2010  pooka Add test cases to check that sysmon/swwdog will panic and reboot
the kernel if left untickled.

Thanks to jmmv for the tip that doing this is possible in atf via
means of fork/wait.
 1.1 04-Aug-2010  pooka Add test of pad(4): stuff some audio into /dev/audio, read it from
/dev/pad. Test that we got sensible output by comparing against
a previous audibly good result.

This exercises auconv, audio and pad.
 1.7.6.1 30-Oct-2012  yamt sync with head
 1.10.2.2 06-Aug-2016  pgoyette Sync with HEAD
 1.10.2.1 31-Jul-2016  pgoyette Descend into fss subdirectory
 1.4 13-Jan-2017  christos Don't play with "../.." in includes for h_macros.h; deal with it centrally.
Minor fixes.
 1.3 29-Jul-2016  pgoyette Remove. Nothing here (or below) seems to refer to it, and it won't
work anyway due to the case of the 'l' in CPPFlAGS
 1.2 23-Jan-2016  christos branches: 1.2.2;
Define _KERNTYPES for things that need it.
 1.1 03-Nov-2010  christos add Makefile.inc everywhere so that we can set WARNS=4 by default. Amazing
how many bugs this found :-)
 1.2.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.2.2.1 06-Aug-2016  pgoyette Sync with HEAD
 1.2 02-Dec-2012  pgoyette Actually remove the no-longer-needed Atffiles
 1.1 04-Aug-2010  pooka branches: 1.1.6; 1.1.12;
Add test of pad(4): stuff some audio into /dev/audio, read it from
/dev/pad. Test that we got sensible output by comparing against
a previous audibly good result.

This exercises auconv, audio and pad.
 1.1.12.1 25-Feb-2013  tls resync with head
 1.1.6.1 16-Jan-2013  yamt sync with (a bit old) head
 1.9 02-Mar-2020  isaki Re-add -lrumpdev dropped in the previous commit.
 1.8 01-Mar-2020  christos Centralize the base rump libraries into a variable used by all the other
Makefiles so that we can make changes to it centrally as needed and have
less mess. Fixes the sun2 build that needs rumpvfs after librump after
the latest changes.
 1.7 11-Feb-2020  isaki Add ATF tests for audio(4).

91 passed test cases
0 failed test cases.
0 expected failed test cases.
62 skipped test cases.

There are many skipped tests, because the test itself supports full-
duplex, half-duplex and uni-directional devices but pad(4) used in ATF
tests is uni-directional device.
 1.6 20-Jun-2019  isaki Rewrite t_pad test.
Previous version compared the pad's output binary passed mulaw-slinear
conversion and frequency conversion with the prepared "good result".
In such case, a test may fail when the implemantation changes. In fact,
the frequency conversion algorithm was changed in isaki-audio2, so
output waveforms is not completely the same (but that's no problem with
the audio waveforms).
New version uses slinear_le/2ch/44100Hz input data and compares the
output binary with the input data. pad with no conversions should
output the same binary.
Fix PR kern/54187.
 1.5 23-Jan-2016  christos branches: 1.5.16;
Define _KERNTYPES for things that need it.
 1.4 02-Dec-2012  pgoyette Build helper programs as PROGS and not as TESTS_{C,SH}

This enables us to remove custom Atffiles whose only purpose was to avoid
using the helpers as tests.

XXX src/tests/dev/dm/ is not (yet) linked into the build!
 1.3 31-Oct-2010  he branches: 1.3.6; 1.3.12;
There's apparently a circular dependency between -lrump and -lrumpuser.
This poses problems when linking statically, as for sun2. Add -lrump
also after -lrumpuser, so that this links statically as well.
 1.2 04-Aug-2010  pooka need to update install filename too
 1.1 04-Aug-2010  pooka Add test of pad(4): stuff some audio into /dev/audio, read it from
/dev/pad. Test that we got sensible output by comparing against
a previous audibly good result.

This exercises auconv, audio and pad.
 1.3.12.1 25-Feb-2013  tls resync with head
 1.3.6.1 16-Jan-2013  yamt sync with (a bit old) head
 1.5.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.33 27-Jun-2025  andvar Fix various typos, mainly in comments.
 1.32 11-Dec-2023  mlelstv branches: 1.32.2;
mmap() fails for size == 0 with EINVAL unless the mapping is anonymous.
 1.31 03-Aug-2023  rin audiotest: Appease GCC 12.3.0 -Wmisleading-indentation

It does not matter whether this statement is a part of this if-then
block or not, anyway. No binary changes.
 1.30 24-Jun-2023  msaitoh Fix typo in comment.
 1.29 23-Apr-2023  mlelstv Allow 24bit support.
 1.28 13-Feb-2023  andvar s/plyaback/playback/ in comment.
 1.27 13-Aug-2022  isaki audiotest: Add two tests for AUDIO_SETINFO after mmap.
These tests affect only standalone test, not atf.
 1.26 13-Aug-2022  isaki audiotest: Fix typo in comments.
 1.25 13-Aug-2022  isaki audiotest: Separate mmap_len test by parameters.
This change affects only standalone test, not atf.
 1.24 07-Aug-2022  andvar fix some typos and grammar in comments.
 1.23 06-Aug-2022  andvar s/blity/bility/ in various words, mainly in comments.
 1.22 31-May-2022  andvar fix various typos in comments, documentation and messages.
 1.21 24-May-2022  andvar s/changable/changeable/ in comments.
 1.20 17-May-2022  andvar fix few typos in comments.
 1.19 23-Apr-2022  isaki tests: Add tests for AUDIO_GET[IO]OFFS ioctls.
- AUDIO_GETIOFFS_one_{RDONLY,RDWR,WRONLY}
- AUDIO_GETOOFFS_one_{RDONLY,RDWR,WRONLY}
- AUDIO_GETOOFFS_wrap_{RDONLY,RDWR,WRONLY}
- AUDIO_GETOOFFS_flush_{RDONLY,RDWR,WRONLY}
- AUDIO_GETOOFFS_set_{RDONLY,RDWR,WRONLY}
 1.18 10-Dec-2021  andvar s/occured/occurred/ in comments, log messages and man pages.
 1.17 08-Dec-2021  andvar fix various typos in comments and log messages.
 1.16 05-Dec-2021  msaitoh s/recored/record/ in comment.
 1.15 21-Aug-2021  andvar s/helt/held+s/eroneously/erroneously/+s/splitted/split/+s/recommented/recommended/
 1.14 21-Jul-2021  isaki Add AUDIO_SETINFO_gain_balance test.
The test checks whether AUDIO_SETINFO can change the gain and the balance
at the same time (if MD driver has the capability). See PR kern/56308.
 1.13 13-Oct-2020  rin Argument for AUDIO_WSEEK ioctl is u_long, not int.

Fix false positive for aarch64eb (LP64BE):
AUDIO_WSEEK, failed, Line 4467: n expects 4 but 0
 1.12 26-Jun-2020  jruoho Reference PRs consistently.
 1.11 01-May-2020  isaki Fix two tests.
- kqueue_mode_{RDONLY,RDWR}_READ: Fix expected value.
This is rest of rev1.9.
- AUDIO_SETINFO_params_simul: Fix condition.
This happens on full-duplex, not bi-directional.
These affect only standalone test, not atf.
 1.10 26-Mar-2020  isaki branches: 1.10.2;
Add tests for poll(POLLIN) before read().
This affects only standalone test, not atf.
 1.9 26-Mar-2020  isaki Sync with sys/dev/audio/audio.c rev1.65.
> Fix to start recording immediately when open() with READ mode is called.
This affects only standalone test, not atf.
 1.8 25-Mar-2020  isaki Use exact match to search testname.
This didn't affect test results.
 1.7 04-Mar-2020  isaki Sync with sys/dev/audio/audio.c rev1.62.
> Restore backward compatibility with netbsd-7 audio.
 1.6 22-Feb-2020  isaki Update AUDIO_SETINFO_channels test.
The kernel limits the number of channels that userland apps can set to
the number of channels supported by the hardware or less.
 1.5 18-Feb-2020  isaki Add tests.
AUDIO_SETINFO_channels
AUDIO_SETINFO_sample_rate
AUDIO_SETINFO_sample_rate_0
 1.4 14-Feb-2020  isaki Improve around {audioctl_,}open_multiuser.
- Make multiuser bool and remove newval.
- try_audioctl_open_multiuser() doesn't need multiuser argument.
 1.3 13-Feb-2020  tnn don't use variable 'newval' uninitialized when multiuser mode unchanged
 1.2 12-Feb-2020  martin Add sentinel to the testtable[] array.
 1.1 11-Feb-2020  isaki Add ATF tests for audio(4).

91 passed test cases
0 failed test cases.
0 expected failed test cases.
62 skipped test cases.

There are many skipped tests, because the test itself supports full-
duplex, half-duplex and uni-directional devices but pad(4) used in ATF
tests is uni-directional device.
 1.10.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.10.2.1 26-Mar-2020  martin file audiotest.c was added on branch phil-wifi on 2020-04-08 14:09:05 +0000
 1.32.2.1 02-Aug-2025  perseant Sync with HEAD
 1.3 20-Jun-2019  isaki Rewrite t_pad test.
Previous version compared the pad's output binary passed mulaw-slinear
conversion and frequency conversion with the prepared "good result".
In such case, a test may fail when the implemantation changes. In fact,
the frequency conversion algorithm was changed in isaki-audio2, so
output waveforms is not completely the same (but that's no problem with
the audio waveforms).
New version uses slinear_le/2ch/44100Hz input data and compares the
output binary with the input data. pad with no conversions should
output the same binary.
Fix PR kern/54187.
 1.2 15-Oct-2016  nat branches: 1.2.14;
pad(4) must be open before corresponding audio device is opened.

OK christos@
 1.1 04-Aug-2010  pooka branches: 1.1.28;
Add test of pad(4): stuff some audio into /dev/audio, read it from
/dev/pad. Test that we got sensible output by comparing against
a previous audibly good result.

This exercises auconv, audio and pad.
 1.1.28.1 04-Nov-2016  pgoyette Sync with HEAD
 1.2.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2 24-Jan-2011  pooka Represent test data as bytes to make it "endian-independent".

from martin
 1.1 04-Aug-2010  pooka branches: 1.1.2;
Add test of pad(4): stuff some audio into /dev/audio, read it from
/dev/pad. Test that we got sensible output by comparing against
a previous audibly good result.

This exercises auconv, audio and pad.
 1.1.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.2 25-Mar-2020  isaki branches: 1.2.2;
Use exact match to search testname.
This didn't affect test results.
 1.1 11-Feb-2020  isaki Add ATF tests for audio(4).

91 passed test cases
0 failed test cases.
0 expected failed test cases.
62 skipped test cases.

There are many skipped tests, because the test itself supports full-
duplex, half-duplex and uni-directional devices but pad(4) used in ATF
tests is uni-directional device.
 1.2.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.2.1 25-Mar-2020  martin file t_audio.awk was added on branch phil-wifi on 2020-04-08 14:09:05 +0000
 1.4 20-Jun-2019  isaki Rewrite t_pad test.
Previous version compared the pad's output binary passed mulaw-slinear
conversion and frequency conversion with the prepared "good result".
In such case, a test may fail when the implemantation changes. In fact,
the frequency conversion algorithm was changed in isaki-audio2, so
output waveforms is not completely the same (but that's no problem with
the audio waveforms).
New version uses slinear_le/2ch/44100Hz input data and compares the
output binary with the input data. pad with no conversions should
output the same binary.
Fix PR kern/54187.
 1.3 07-Nov-2010  jmmv branches: 1.3.46;
Adjusts tests after import of atf-0.12:

- The use.fs property is gone.
- Mark the tests/fs/t_create:attrs test as broken when using the default
unprivileged-user:_atf setting. This probably deserves a fix somehow
but I'm not sure at this point.
 1.2 04-Aug-2010  pooka Update test program to deal with uuencoded golden data.
XXX: is it not possible to use a pipeline in atf_check?
 1.1 04-Aug-2010  pooka Add test of pad(4): stuff some audio into /dev/audio, read it from
/dev/pad. Test that we got sensible output by comparing against
a previous audibly good result.

This exercises auconv, audio and pad.
 1.3.46.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2 04-Aug-2010  pooka Actually, some nagging voice in my head tells me that all binary files
in the repo should be uuencoded, so uuencode the golden audio output.
 1.1 04-Aug-2010  pooka Add test of pad(4): stuff some audio into /dev/audio, read it from
/dev/pad. Test that we got sensible output by comparing against
a previous audibly good result.

This exercises auconv, audio and pad.
 1.5 20-Jun-2019  isaki Rewrite t_pad test.
Previous version compared the pad's output binary passed mulaw-slinear
conversion and frequency conversion with the prepared "good result".
In such case, a test may fail when the implemantation changes. In fact,
the frequency conversion algorithm was changed in isaki-audio2, so
output waveforms is not completely the same (but that's no problem with
the audio waveforms).
New version uses slinear_le/2ch/44100Hz input data and compares the
output binary with the input data. pad with no conversions should
output the same binary.
Fix PR kern/54187.
 1.4 27-Jan-2017  nat branches: 1.4.12;
Revert to previous. Audio passes the test properly again.
 1.3 11-Dec-2016  nat branches: 1.3.2;
Update test output to reflect audio changes.
 1.2 26-Feb-2016  nat branches: 1.2.2;
Fix soft volume audio distortion. OK jmcneil@.
Update atf pad expected output.
 1.1 04-Aug-2010  pooka Actually, some nagging voice in my head tells me that all binary files
in the repo should be uuencoded, so uuencode the golden audio output.
 1.2.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.2.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.3.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.4.12.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.13 12-Aug-2022  riastradh cgdconfig(8): Add support for shared keys.

New clause `shared <id> algorithm <alg> subkey <info>' in a keygen
block enables `cgdconfig -C' to reuse a key between different params
files, so you can, e.g., use a single password for multiple disks.
This is better than simply caching the password itself because:

- Hashing the password is expensive, so it should only be done once.

Suppose your budget is time t before you get bored, and you
calibrate password hash parameters to unlock n disks before you get
bored waiting for `cgdconfig -C'.

. With n password hashings the adversary's cost goes up only by a
factor of t/n.
. With one password hashing and n subkeys the adversary's cost goes
up by a factor of n.

And if you ever add a disk, rehashing it will make `cgdconfig -C'
go over budget, whereas another subkey adds negligible cost to you.

- Subkeys work for other types of keygen blocks, like shell_cmd,
which could be used to get a key from a hardware token that needs a
button press.

The <info> parameter must be different for each params file;
everything else in the keygen block must be the same. With this
clause, the keygen block determines a shared key used only to derive
keys; the actual key used by cgdconfig is derived from the shared key
by the specified algorithm.

The only supported algorithm is hkdf-hmac-sha256, which uses
HKDF-Expand of RFC 5869 instantiated with SHA-256.

Example:

algorithm aes-cbc;
iv-method encblkno1;
keylength 128;
verify_method none;
keygen pkcs5_pbkdf2/sha1 {
iterations 39361;
salt AAAAgMoHiYonye6KogdYJAobCHE=;
shared "pw" algorithm hkdf-hmac-sha256
subkey AAAAgFlw0BMQ5gY+haYkZ6JC+yY=;
};

The key used for this disk will be derived by

HKDF-HMAC-SHA256_k(WXDQExDmBj6FpiRnokL7Jg==),

where k is the outcome of PBKDF2-SHA1 with the given parameters.

Note that <info> encodes a four-byte prefix giving the big-endian
length in bits of the info argument to HKDF, just like all other bit
strings in cgdconfig parameters files.

If you have multiple disks configured using the same keygen block
except for the info parameter, `cgdconfig -C' will only prompt once
for your passphrase, generate a shared key k with PBKDF2 as usual,
and then reuse it for each of the disks.
 1.12 12-Aug-2022  riastradh cgdconfig(8): New -t operation just prints the derived key in base64.

For testing purposes.
 1.11 29-Jun-2020  riastradh New cgd cipher adiantum.

Adiantum is a wide-block cipher, built out of AES, XChaCha12,
Poly1305, and NH, defined in

Paul Crowley and Eric Biggers, `Adiantum: length-preserving
encryption for entry-level processors', IACR Transactions on
Symmetric Cryptology 2018(4), pp. 39--61.

Adiantum provides better security than a narrow-block cipher with CBC
or XTS, because every bit of each sector affects every other bit,
whereas with CBC each block of plaintext only affects the following
blocks of ciphertext in the disk sector, and with XTS each block of
plaintext only affects its own block of ciphertext and nothing else.

Adiantum generally provides much better performance than
constant-time AES-CBC or AES-XTS software do without hardware
support, and performance comparable to or better than the
variable-time (i.e., leaky) AES-CBC and AES-XTS software we had
before. (Note: Adiantum also uses AES as a subroutine, but only once
per disk sector. It takes only a small fraction of the time spent by
Adiantum, so there's relatively little performance impact to using
constant-time AES software over using variable-time AES software for
it.)

Adiantum naturally scales to essentially arbitrary disk sector sizes;
sizes >=1024-bytes take the most advantage of Adiantum's design for
performance, so 4096-byte sectors would be a natural choice if we
taught cgd to change the disk sector size. (However, it's a
different cipher for each disk sector size, so it _must_ be a cgd
parameter.)

The paper presents a similar construction HPolyC. The salient
difference is that HPolyC uses Poly1305 directly, whereas Adiantum
uses Poly1395(NH(...)). NH is annoying because it requires a
1072-byte key, which means the test vectors are ginormous, and
changing keys is costly; HPolyC avoids these shortcomings by using
Poly1305 directly, but HPolyC is measurably slower, costing about
1.5x what Adiantum costs on 4096-byte sectors.

For the purposes of cgd, we will reuse each key for many messages,
and there will be very few keys in total (one per cgd volume) so --
except for the annoying verbosity of test vectors -- the tradeoff
weighs in the favour of Adiantum, especially if we teach cgd to do
>>512-byte sectors.

For now, everything that Adiantum needs beyond what's already in the
kernel is gathered into a single file, including NH, Poly1305, and
XChaCha12. We can split those out -- and reuse them, and provide MD
tuned implementations, and so on -- as needed; this is just a first
pass to get Adiantum implemented for experimentation.
 1.10 01-Mar-2020  christos Centralize the base rump libraries into a variable used by all the other
Makefiles so that we can make changes to it centrally as needed and have
less mess. Fixes the sun2 build that needs rumpvfs after librump after
the latest changes.
 1.9 01-Mar-2020  christos librump depends on vfs so add a dependency on for sun2.
 1.8 21-May-2017  riastradh branches: 1.8.10;
Remove MKCRYPTO option.

Originally, MKCRYPTO was introduced because the United States
classified cryptography as a munition and restricted its export. The
export controls were substantially relaxed fifteen years ago, and are
essentially irrelevant for software with published source code.

In the intervening time, nobody bothered to remove the option after
its motivation -- the US export restriction -- was eliminated. I'm
not aware of any other operating system that has a similar option; I
expect it is mainly out of apathy for churn that we still have it.
Today, cryptography is an essential part of modern computing -- you
can't use the internet responsibly without cryptography.

The position of the TNF board of directors is that TNF makes no
representation that MKCRYPTO=no satisfies any country's cryptography
regulations.

My personal position is that the availability of cryptography is a
basic human right; that any local laws restricting it to a privileged
few are fundamentally immoral; and that it is wrong for developers to
spend effort crippling cryptography to work around such laws.

As proposed on tech-crypto, tech-security, and tech-userlevel to no
objections:

https://mail-index.netbsd.org/tech-crypto/2017/05/06/msg000719.html
https://mail-index.netbsd.org/tech-security/2017/05/06/msg000928.html
https://mail-index.netbsd.org/tech-userlevel/2017/05/06/msg010547.html

P.S. Reviewing all the uses of MKCRYPTO in src revealed a lot of
*bad* crypto that was conditional on it, e.g. DES in telnet... That
should probably be removed too, but on the grounds that it is bad,
not on the grounds that it is (nominally) crypto.
 1.7 11-Nov-2016  alnsn Add 3des-cbc tests with 192 bits key.
 1.6 10-Nov-2016  alnsn Add blowfish-cbc tests for 128, 256 and 448 bits keys.
 1.5 07-Nov-2016  scole Only build t_cgd_aes if MKCRYPTO==yes and MKRUMP==yes.
 1.4 06-Nov-2016  alnsn Don't build t_cgd_aes if ${MKCRYPTO} == "no".
 1.3 06-Nov-2016  alnsn Add tests for not-yet-committed cgd algorithm AES-XTS.

The tests are marked as expected failures.
 1.2 14-Dec-2010  pooka branches: 1.2.28;
Retire the old C helper in h_img2cgd since we can now write everything
with a shellscript in terms of rump.cgdconfig and dd.
 1.1 11-Nov-2010  pooka Add rudimentary cgd tests. The tests use cgd to transform a
plaintext into into an encrypted image and back into plaintext by
doing rump I/O on /dev/cgd. There is one test to check that giving
the same password for both encryption and decryption produces the
same plaintext and another to check that giving a different passwords
does not produce the same plaintext.

This could be fairly easily extended to test all feature of cgd
(hint hint). For example, now cgd.conf is included in cvs, but
the only reason for that is that without further hacking cgdconfig
uses /dev/random quality random to generate the salt for a
pkcsetcetc_kdf2 cgconfig -g, and making an automated test block on
the entropy pool is just not good form. Details are everything.
 1.2.28.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.8.10.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1 12-Aug-2022  riastradh cgdconfig(8): Add support for shared keys.

New clause `shared <id> algorithm <alg> subkey <info>' in a keygen
block enables `cgdconfig -C' to reuse a key between different params
files, so you can, e.g., use a single password for multiple disks.
This is better than simply caching the password itself because:

- Hashing the password is expensive, so it should only be done once.

Suppose your budget is time t before you get bored, and you
calibrate password hash parameters to unlock n disks before you get
bored waiting for `cgdconfig -C'.

. With n password hashings the adversary's cost goes up only by a
factor of t/n.
. With one password hashing and n subkeys the adversary's cost goes
up by a factor of n.

And if you ever add a disk, rehashing it will make `cgdconfig -C'
go over budget, whereas another subkey adds negligible cost to you.

- Subkeys work for other types of keygen blocks, like shell_cmd,
which could be used to get a key from a hardware token that needs a
button press.

The <info> parameter must be different for each params file;
everything else in the keygen block must be the same. With this
clause, the keygen block determines a shared key used only to derive
keys; the actual key used by cgdconfig is derived from the shared key
by the specified algorithm.

The only supported algorithm is hkdf-hmac-sha256, which uses
HKDF-Expand of RFC 5869 instantiated with SHA-256.

Example:

algorithm aes-cbc;
iv-method encblkno1;
keylength 128;
verify_method none;
keygen pkcs5_pbkdf2/sha1 {
iterations 39361;
salt AAAAgMoHiYonye6KogdYJAobCHE=;
shared "pw" algorithm hkdf-hmac-sha256
subkey AAAAgFlw0BMQ5gY+haYkZ6JC+yY=;
};

The key used for this disk will be derived by

HKDF-HMAC-SHA256_k(WXDQExDmBj6FpiRnokL7Jg==),

where k is the outcome of PBKDF2-SHA1 with the given parameters.

Note that <info> encodes a four-byte prefix giving the big-endian
length in bits of the info argument to HKDF, just like all other bit
strings in cgdconfig parameters files.

If you have multiple disks configured using the same keygen block
except for the info parameter, `cgdconfig -C' will only prompt once
for your passphrase, generate a shared key k with PBKDF2 as usual,
and then reuse it for each of the disks.
 1.1 14-Dec-2010  pooka Retire the old C helper in h_img2cgd since we can now write everything
with a shellscript in terms of rump.cgdconfig and dd.
 1.14 30-Nov-2022  martin Unfortunately rump does not provide the same magic as MAKEDEV does
for native /dev and create an alias for disk devices w/o partition
latter pointing at the raw partition, so for rump based tests we
actually have to calculate the concrete device name.

Use an idiom suggested by kre for this which also works for ports that
have kern.rawpartition > 4.
 1.13 10-Apr-2019  kre Fix quoting (quotes really do not nest...) and remove a bunch of it
that is harmless, but also pointless (in sh, quotes do not make strings,
everything is a string, rather they hide characters which would have
some other meaning unquoted (like spaces) - quotes are not needed around
strings like "descr" so remove them...

Be more consistent with line wrap style, try to avoid wrapping in the
middle of a (sh) word where possible. Avoid \ use when it is not needed.

Un-KNF (C style) - sh has no declarations, there is no need to leave
blank lines at the head of a function to mark the end of the declarations.

This should be a NFC - but the quoting really was broken before, just
was probably harmless breakage.
 1.12 10-Apr-2019  kre PR bin/53999 from rudolf (eq.cz)

Fix cgdconfig to report verification failures with gpt and mbr
verification methods (and not treat them as silent hard errors).
This also causes the cgd to be unconfigured when one of those
verification methods fails.

Add ATF tests to check that bad verification is reported, and
does not leave the cgd configured.

Patches from the PR applied.
 1.11 19-Feb-2013  joerg branches: 1.11.30;
Check for RUMP programs before using them.
 1.10 19-May-2011  riastradh branches: 1.10.4; 1.10.10;
Expand tests for unaligned writes to cgd. No more xfail.

PR kern/44515
PR kern/44964
 1.9 14-May-2011  jmmv Instead of doing 'atf_check ... sh -c foo', just do 'atf_check ... -x foo'.
 1.8 22-Mar-2011  jmmv Force cleanup parts to exit with a success status. Failures in cleanup
should not be allowed by atf-run (although they currently are ignored).
 1.7 04-Feb-2011  pooka test case for PR kern/44515
 1.6 04-Feb-2011  pooka convert tests from oldstyle dd rif/rof to newstyle dd | rump.dd
 1.5 03-Jan-2011  pooka branches: 1.5.2;
make this work when rawpart != d
 1.4 30-Dec-2010  pooka Substitute a surgical rump_server configuration for rump_allserver
now that it's possible. With warm fs cache, the startup time of
the former is 0.01s and the latter 0.1s. With cold caches it's
0.2s vs 2s.
 1.3 15-Dec-2010  pooka Use proper cleanup.

XXX: the atf sh "compiler" should check for errors.
 1.2 14-Dec-2010  pooka Retire the old C helper in h_img2cgd since we can now write everything
with a shellscript in terms of rump.cgdconfig and dd.
 1.1 11-Nov-2010  pooka Add rudimentary cgd tests. The tests use cgd to transform a
plaintext into into an encrypted image and back into plaintext by
doing rump I/O on /dev/cgd. There is one test to check that giving
the same password for both encryption and decryption produces the
same plaintext and another to check that giving a different passwords
does not produce the same plaintext.

This could be fairly easily extended to test all feature of cgd
(hint hint). For example, now cgd.conf is included in cvs, but
the only reason for that is that without further hacking cgdconfig
uses /dev/random quality random to generate the salt for a
pkcsetcetc_kdf2 cgconfig -g, and making an automated test block on
the entropy pool is just not good form. Details are everything.
 1.5.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.10.10.1 25-Feb-2013  tls resync with head
 1.10.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.11.30.1 10-Jun-2019  christos Sync with HEAD
 1.3 15-Aug-2020  mlelstv Plaintext buffers are used directly for write() operations to the raw device.
Align them to the needs of cgd(4).
 1.2 13-Jan-2017  christos Don't play with "../.." in includes for h_macros.h; deal with it centrally.
Minor fixes.
 1.1 11-Nov-2016  alnsn branches: 1.1.2;
Add 3des-cbc tests with 192 bits key.
 1.1.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.1.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.1.2.1 11-Nov-2016  pgoyette file t_cgd_3des.c was added on branch pgoyette-localcount on 2017-01-07 08:56:54 +0000
 1.5 20-Aug-2020  riastradh clang can't handle __aligned on anonymous structure initializers.
 1.4 15-Aug-2020  mlelstv Plaintext buffers are used directly for write() operations to the raw device.
Align them to the needs of cgd(4).
 1.3 30-Jun-2020  riastradh Missed a spot -- one more 32-bit sign-compare issue.
 1.2 30-Jun-2020  riastradh Fix sign-compare issue on 32-bit systems.

Built fine on amd64, where all unsigned values are representable in
ssize_t, but I didn't try building on i386, where they're not.
 1.1 29-Jun-2020  riastradh New cgd cipher adiantum.

Adiantum is a wide-block cipher, built out of AES, XChaCha12,
Poly1305, and NH, defined in

Paul Crowley and Eric Biggers, `Adiantum: length-preserving
encryption for entry-level processors', IACR Transactions on
Symmetric Cryptology 2018(4), pp. 39--61.

Adiantum provides better security than a narrow-block cipher with CBC
or XTS, because every bit of each sector affects every other bit,
whereas with CBC each block of plaintext only affects the following
blocks of ciphertext in the disk sector, and with XTS each block of
plaintext only affects its own block of ciphertext and nothing else.

Adiantum generally provides much better performance than
constant-time AES-CBC or AES-XTS software do without hardware
support, and performance comparable to or better than the
variable-time (i.e., leaky) AES-CBC and AES-XTS software we had
before. (Note: Adiantum also uses AES as a subroutine, but only once
per disk sector. It takes only a small fraction of the time spent by
Adiantum, so there's relatively little performance impact to using
constant-time AES software over using variable-time AES software for
it.)

Adiantum naturally scales to essentially arbitrary disk sector sizes;
sizes >=1024-bytes take the most advantage of Adiantum's design for
performance, so 4096-byte sectors would be a natural choice if we
taught cgd to change the disk sector size. (However, it's a
different cipher for each disk sector size, so it _must_ be a cgd
parameter.)

The paper presents a similar construction HPolyC. The salient
difference is that HPolyC uses Poly1305 directly, whereas Adiantum
uses Poly1395(NH(...)). NH is annoying because it requires a
1072-byte key, which means the test vectors are ginormous, and
changing keys is costly; HPolyC avoids these shortcomings by using
Poly1305 directly, but HPolyC is measurably slower, costing about
1.5x what Adiantum costs on 4096-byte sectors.

For the purposes of cgd, we will reuse each key for many messages,
and there will be very few keys in total (one per cgd volume) so --
except for the annoying verbosity of test vectors -- the tradeoff
weighs in the favour of Adiantum, especially if we teach cgd to do
>>512-byte sectors.

For now, everything that Adiantum needs beyond what's already in the
kernel is gathered into a single file, including NH, Poly1305, and
XChaCha12. We can split those out -- and reuse them, and provide MD
tuned implementations, and so on -- as needed; this is just a first
pass to get Adiantum implemented for experimentation.
 1.8 15-Aug-2020  mlelstv Plaintext buffers are used directly for write() operations to the raw device.
Align them to the needs of cgd(4).
 1.7 10-Jul-2019  martin Gracefully skip test if not enough space in temporary directory.
 1.6 13-Jan-2017  christos branches: 1.6.14;
Don't play with "../.." in includes for h_macros.h; deal with it centrally.
Minor fixes.
 1.5 11-Dec-2016  alnsn branches: 1.5.2;
AES XTS unit tests should now pass.
 1.4 24-Nov-2016  alnsn Switch to CHECK_LIBC for writing.
 1.3 09-Nov-2016  alnsn Add aes-cbc tests.
 1.2 07-Nov-2016  alnsn Don't use mktemp.
 1.1 06-Nov-2016  alnsn Add tests for not-yet-committed cgd algorithm AES-XTS.

The tests are marked as expected failures.
 1.5.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.5.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.5.2.1 11-Dec-2016  pgoyette file t_cgd_aes.c was added on branch pgoyette-localcount on 2017-01-07 08:56:54 +0000
 1.6.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3 15-Aug-2020  mlelstv Plaintext buffers are used directly for write() operations to the raw device.
Align them to the needs of cgd(4).
 1.2 13-Jan-2017  christos Don't play with "../.." in includes for h_macros.h; deal with it centrally.
Minor fixes.
 1.1 10-Nov-2016  alnsn branches: 1.1.2;
Add blowfish-cbc tests for 128, 256 and 448 bits keys.
 1.1.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.1.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.1.2.1 10-Nov-2016  pgoyette file t_cgd_blowfish.c was added on branch pgoyette-localcount on 2017-01-07 08:56:54 +0000
 1.4 13-Aug-2022  hannken When run from py-anita/amd64 this test fails with:

cgdconfig: getfsspecname failed: no match for `wd0e'

as the virtual machine has root on dk0, dk0 at wd0 and trying to
open wd0e fails.

This tests runs without a rump kernel and therefore should not
even try to open configured devices on the host. Replace the
disks "wd0e" and "ld1e" with non-existant disks "dska" and "dskb".
 1.3 12-Aug-2022  riastradh cgdconfig(8): Add support for shared keys.

New clause `shared <id> algorithm <alg> subkey <info>' in a keygen
block enables `cgdconfig -C' to reuse a key between different params
files, so you can, e.g., use a single password for multiple disks.
This is better than simply caching the password itself because:

- Hashing the password is expensive, so it should only be done once.

Suppose your budget is time t before you get bored, and you
calibrate password hash parameters to unlock n disks before you get
bored waiting for `cgdconfig -C'.

. With n password hashings the adversary's cost goes up only by a
factor of t/n.
. With one password hashing and n subkeys the adversary's cost goes
up by a factor of n.

And if you ever add a disk, rehashing it will make `cgdconfig -C'
go over budget, whereas another subkey adds negligible cost to you.

- Subkeys work for other types of keygen blocks, like shell_cmd,
which could be used to get a key from a hardware token that needs a
button press.

The <info> parameter must be different for each params file;
everything else in the keygen block must be the same. With this
clause, the keygen block determines a shared key used only to derive
keys; the actual key used by cgdconfig is derived from the shared key
by the specified algorithm.

The only supported algorithm is hkdf-hmac-sha256, which uses
HKDF-Expand of RFC 5869 instantiated with SHA-256.

Example:

algorithm aes-cbc;
iv-method encblkno1;
keylength 128;
verify_method none;
keygen pkcs5_pbkdf2/sha1 {
iterations 39361;
salt AAAAgMoHiYonye6KogdYJAobCHE=;
shared "pw" algorithm hkdf-hmac-sha256
subkey AAAAgFlw0BMQ5gY+haYkZ6JC+yY=;
};

The key used for this disk will be derived by

HKDF-HMAC-SHA256_k(WXDQExDmBj6FpiRnokL7Jg==),

where k is the outcome of PBKDF2-SHA1 with the given parameters.

Note that <info> encodes a four-byte prefix giving the big-endian
length in bits of the info argument to HKDF, just like all other bit
strings in cgdconfig parameters files.

If you have multiple disks configured using the same keygen block
except for the info parameter, `cgdconfig -C' will only prompt once
for your passphrase, generate a shared key k with PBKDF2 as usual,
and then reuse it for each of the disks.
 1.2 12-Aug-2022  riastradh cgdconfig(8): New -T operation prints all generated keys in cgd.conf.

For testing purposes.
 1.1 12-Aug-2022  riastradh cgdconfig(8): New -t operation just prints the derived key in base64.

For testing purposes.
 1.1 14-Aug-2016  jakllsch branches: 1.1.2;
tests for sys/dev/clock_subr.c
 1.1.2.2 14-Sep-2016  pgoyette Sync with HEAD
 1.1.2.1 14-Aug-2016  pgoyette file Makefile was added on branch pgoyette-localcount on 2016-09-14 03:04:19 +0000
 1.1 14-Aug-2016  jakllsch branches: 1.1.2;
tests for sys/dev/clock_subr.c
 1.1.2.2 14-Sep-2016  pgoyette Sync with HEAD
 1.1.2.1 14-Aug-2016  pgoyette file clock_subr_test_data_gen.sh was added on branch pgoyette-localcount on 2016-09-14 03:04:19 +0000
 1.3 13-Jan-2017  christos Don't play with "../.." in includes for h_macros.h; deal with it centrally.
Minor fixes.
 1.2 17-Aug-2016  jakllsch branches: 1.2.2;
These clock_subr tests are no longer expected to fail.
 1.1 14-Aug-2016  jakllsch tests for sys/dev/clock_subr.c
 1.2.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.2.2.2 14-Sep-2016  pgoyette Sync with HEAD
 1.2.2.1 17-Aug-2016  pgoyette file t_clock_subr.c was added on branch pgoyette-localcount on 2016-09-14 03:04:19 +0000
 1.2 02-Dec-2012  pgoyette Actually remove the no-longer-needed Atffiles
 1.1 06-Oct-2010  haad branches: 1.1.6; 1.1.12;
Import new test program for device-mapper driver it currently call dm_version_list
and dm_targets_list ioctl to test if dm driver inside rump works.

It will be disable for now, because I need to find out why if I run this
test by atf-run it fails while running h_dm by hand works.

XXX. component.c in rump/libdm calls devsw_attach before dm_modcmd can do
that therefore unmodified modcmd returns error.
 1.1.12.1 25-Feb-2013  tls resync with head
 1.1.6.1 16-Jan-2013  yamt sync with (a bit old) head
 1.4 01-Mar-2020  christos Centralize the base rump libraries into a variable used by all the other
Makefiles so that we can make changes to it centrally as needed and have
less mess. Fixes the sun2 build that needs rumpvfs after librump after
the latest changes.
 1.3 23-Jan-2016  christos branches: 1.3.16;
Define _KERNTYPES for things that need it.
 1.2 02-Dec-2012  pgoyette Build helper programs as PROGS and not as TESTS_{C,SH}

This enables us to remove custom Atffiles whose only purpose was to avoid
using the helpers as tests.

XXX src/tests/dev/dm/ is not (yet) linked into the build!
 1.1 06-Oct-2010  haad branches: 1.1.6; 1.1.12;
Import new test program for device-mapper driver it currently call dm_version_list
and dm_targets_list ioctl to test if dm driver inside rump works.

It will be disable for now, because I need to find out why if I run this
test by atf-run it fails while running h_dm by hand works.

XXX. component.c in rump/libdm calls devsw_attach before dm_modcmd can do
that therefore unmodified modcmd returns error.
 1.1.12.1 25-Feb-2013  tls resync with head
 1.1.6.1 16-Jan-2013  yamt sync with (a bit old) head
 1.3.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1 06-Oct-2010  haad Import new test program for device-mapper driver it currently call dm_version_list
and dm_targets_list ioctl to test if dm driver inside rump works.

It will be disable for now, because I need to find out why if I run this
test by atf-run it fails while running h_dm by hand works.

XXX. component.c in rump/libdm calls devsw_attach before dm_modcmd can do
that therefore unmodified modcmd returns error.
 1.1 06-Oct-2010  haad Import new test program for device-mapper driver it currently call dm_version_list
and dm_targets_list ioctl to test if dm driver inside rump works.

It will be disable for now, because I need to find out why if I run this
test by atf-run it fails while running h_dm by hand works.

XXX. component.c in rump/libdm calls devsw_attach before dm_modcmd can do
that therefore unmodified modcmd returns error.
 1.2 23-Jan-2016  christos XXX: use unused variables.
 1.1 06-Oct-2010  haad Import new test program for device-mapper driver it currently call dm_version_list
and dm_targets_list ioctl to test if dm driver inside rump works.

It will be disable for now, because I need to find out why if I run this
test by atf-run it fails while running h_dm by hand works.

XXX. component.c in rump/libdm calls devsw_attach before dm_modcmd can do
that therefore unmodified modcmd returns error.
 1.2 07-Nov-2010  jmmv Adjusts tests after import of atf-0.12:

- The use.fs property is gone.
- Mark the tests/fs/t_create:attrs test as broken when using the default
unprivileged-user:_atf setting. This probably deserves a fix somehow
but I'm not sure at this point.
 1.1 06-Oct-2010  haad Import new test program for device-mapper driver it currently call dm_version_list
and dm_targets_list ioctl to test if dm driver inside rump works.

It will be disable for now, because I need to find out why if I run this
test by atf-run it fails while running h_dm by hand works.

XXX. component.c in rump/libdm calls devsw_attach before dm_modcmd can do
that therefore unmodified modcmd returns error.
 1.2 03-Aug-2016  pgoyette We don't have any FILES, so no need for a FILESDIR
 1.1 29-Jul-2016  pgoyette branches: 1.1.2;
Add a basic test for fss(4)

XXX For now, we just create required files (including mount-points)
XXX in the test's working directory. Eventually someone with more
XXX rump-foo than I should create a fss rump-component and then update
XXX the test to run under rump.
 1.1.2.2 29-Jul-2016  pgoyette Import the new fss(4) test here, too
 1.1.2.1 29-Jul-2016  pgoyette file Makefile was added on branch pgoyette-localcount on 2016-07-29 10:57:32 +0000
 1.7 19-Apr-2025  rin tests: Skip vnd(4)-based tests on vax for now

in order to avoid kernel crash described in PR port-vax/59287
 1.6 11-May-2023  gutteridge branches: 1.6.2;
t_fss.sh: add missing test case head
 1.5 30-Nov-2022  martin Avoid explicitly naming the raw part device with a partition letter - use
the non-partition letter variant instead.
 1.4 14-Jan-2021  simonb Unmount and unconfigure in the reverse order that they were done. Fixes
problem with leaving a dangling snapshot configured.
 1.3 15-Mar-2017  martin Do not assume an all-zeroes disk label will read back as a disk with
an 'a' partition covering the whole disk, instead use the raw partition.
Also skip this test if the fss device is not available.
With lots of help from pgoyette.
 1.2 29-Jul-2016  pgoyette branches: 1.2.2;
Mount the snapshot read-only; otherwise we get a nasty panic.

Re-order the clean-up steps to properly undo what we did.
 1.1 29-Jul-2016  pgoyette branches: 1.1.2;
Add a basic test for fss(4)

XXX For now, we just create required files (including mount-points)
XXX in the test's working directory. Eventually someone with more
XXX rump-foo than I should create a fss rump-component and then update
XXX the test to run under rump.
 1.1.2.4 20-Mar-2017  pgoyette Sync with HEAD
 1.1.2.3 31-Jul-2016  pgoyette Import changes from HEAD
 1.1.2.2 29-Jul-2016  pgoyette Import the new fss(4) test here, too
 1.1.2.1 29-Jul-2016  pgoyette file t_fss.sh was added on branch pgoyette-localcount on 2016-07-29 10:57:32 +0000
 1.2.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.6.2.1 02-Aug-2025  perseant Sync with HEAD
 1.2 02-Dec-2012  pgoyette Actually remove the no-longer-needed Atffiles
 1.1 23-Nov-2010  pooka branches: 1.1.6; 1.1.12;
Add simple test for md(4) which just stuffs junk into /dev/rmd0d
and checks the same data can be retrieved.
 1.1.12.1 25-Feb-2013  tls resync with head
 1.1.6.1 16-Jan-2013  yamt sync with (a bit old) head
 1.7 01-Mar-2020  christos Centralize the base rump libraries into a variable used by all the other
Makefiles so that we can make changes to it centrally as needed and have
less mess. Fixes the sun2 build that needs rumpvfs after librump after
the latest changes.
 1.6 23-Jan-2016  christos branches: 1.6.16;
Define _KERNTYPES for things that need it.
 1.5 07-Jan-2015  pooka Move sysproxy support into a separate component, rumpkern_sysproxy,
instead of it being always provided by the rump kernel base. This
move accomplishes two things:

1) it is no longer necessary to provide sysproxy hypercall stubs for
platforms which do not want to use sysproxy
2) it is easier to reason about the security aspects, since configurations
not linking the sysproxy component simply do not support remote
system calls

discussed on rumpkernel-users
 1.4 09-Jun-2014  he When linking statically (as for sun2), need to list -lrump also
after -lrumpuser, because rump_pub_lwproc_switch is used in the
latter and defined in the former.
 1.3 02-Dec-2012  pgoyette branches: 1.3.6;
Build helper programs as PROGS and not as TESTS_{C,SH}

This enables us to remove custom Atffiles whose only purpose was to avoid
using the helpers as tests.

XXX src/tests/dev/dm/ is not (yet) linked into the build!
 1.2 30-Nov-2010  pooka branches: 1.2.6; 1.2.12;
don't include librump twice
 1.1 23-Nov-2010  pooka Add simple test for md(4) which just stuffs junk into /dev/rmd0d
and checks the same data can be retrieved.
 1.2.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.12.1 25-Feb-2013  tls resync with head
 1.2.6.1 16-Jan-2013  yamt sync with (a bit old) head
 1.3.6.1 10-Aug-2014  tls Rebase.
 1.6.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5 16-Sep-2021  andvar fix typos in word "successful".
 1.4 10-Feb-2011  pooka explicitly zero-fill the initial md backend
 1.3 30-Nov-2010  pooka branches: 1.3.2;
comment tyops
 1.2 30-Nov-2010  pooka Get rid of the "sleep 1" by using rump_daemonize_begin/end().
Notably, md is a little tricky for this, since the ioctl that
configures the service also blocks in the kernel. Therefore, use
an additional pthread to probe when the service is fully configured
and the server can detach.

Also, rawpart love.
 1.1 23-Nov-2010  pooka Add simple test for md(4) which just stuffs junk into /dev/rmd0d
and checks the same data can be retrieved.
 1.3.2.1 17-Feb-2011  bouyer Sync with HEAD
 1.8 30-Nov-2022  martin Unfortunately rump does not provide the same magic as MAKEDEV does
for native /dev and create an alias for disk devices w/o partition
latter pointing at the raw partition, so for rump based tests we
actually have to calculate the concrete device name.

Use an idiom suggested by kre for this which also works for ports that
have kern.rawpartition > 4.
 1.7 14-May-2011  jmmv Instead of doing 'atf_check ... sh -c foo', just do 'atf_check ... -x foo'.
 1.6 04-Feb-2011  pooka convert tests from oldstyle dd rif/rof to newstyle dd | rump.dd
 1.5 03-Jan-2011  pooka branches: 1.5.2;
use rawpart
 1.4 12-Dec-2010  pooka use rump.halt
 1.3 30-Nov-2010  pooka cleanup server after use
(XXX: need better way to reboot it)
 1.2 30-Nov-2010  pooka Get rid of the "sleep 1" by using rump_daemonize_begin/end().
Notably, md is a little tricky for this, since the ioctl that
configures the service also blocks in the kernel. Therefore, use
an additional pthread to probe when the service is fully configured
and the server can detach.

Also, rawpart love.
 1.1 23-Nov-2010  pooka Add simple test for md(4) which just stuffs junk into /dev/rmd0d
and checks the same data can be retrieved.
 1.5.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.2 15-Dec-2010  pooka fix post-move testsdir. duh
 1.1 15-Dec-2010  pooka "A few seconds later" I realized the kernel directory is dev/raidframe,
not dev/raid, so reflect this in the test dir. Affects location
for test of PR kern/44239.
 1.16 30-Nov-2022  martin Unfortunately rump does not provide the same magic as MAKEDEV does
for native /dev and create an alias for disk devices w/o partition
latter pointing at the raw partition, so for rump based tests we
actually have to calculate the concrete device name.

Use an idiom suggested by kre for this which also works for ports that
have kern.rawpartition > 4.
 1.15 30-Nov-2020  msaitoh s/ we we / we /
 1.14 10-Jul-2019  martin Reduce disk image size for tests (PR 44239 has been fixed)
 1.13 18-Jan-2018  mrg branches: 1.13.4;
implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.
 1.12 19-Feb-2013  joerg Check for RUMP programs before using them.
 1.11 15-Oct-2011  gson branches: 1.11.2; 1.11.8;
Fix cut-and-paste-o that casused the raid1_normal test case to have no
cleanup function defined, resulting in a rump_server process hanging
around after the tests completed.
 1.10 09-Aug-2011  martin Add missing RUMP_SERVER export, so the "normal" test does not fail with
a stupid error.
 1.9 29-Jul-2011  oster Note that PR kern/44251 is fixed.
Add tests for normal configuration of RAID 1 and RAID 5 sets.
 1.8 14-May-2011  jmmv Instead of doing 'atf_check ... sh -c foo', just do 'atf_check ... -x foo'.
 1.7 01-Mar-2011  riz PR#44239 is now fixed, remove the xfail from the test.
 1.6 04-Feb-2011  pooka convert tests from oldstyle dd rif/rof to newstyle dd | rump.dd
 1.5 30-Dec-2010  pooka branches: 1.5.2;
Substitute a surgical rump_server configuration for rump_allserver
now that it's possible. With warm fs cache, the startup time of
the former is 0.01s and the latter 0.1s. With cold caches it's
0.2s vs 2s.
 1.4 18-Dec-2010  pooka test case for PR kern/44251
 1.3 18-Dec-2010  pooka Check that raid1 and raid5 can serve data after a component has
been nuked.
 1.2 17-Dec-2010  pooka fix editing artifact
 1.1 15-Dec-2010  pooka "A few seconds later" I realized the kernel directory is dev/raidframe,
not dev/raid, so reflect this in the test dir. Affects location
for test of PR kern/44239.
 1.5.2.2 05-Mar-2011  bouyer Sync with HEAD
 1.5.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.11.8.1 25-Feb-2013  tls resync with head
 1.11.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.8 01-Mar-2020  christos Centralize the base rump libraries into a variable used by all the other
Makefiles so that we can make changes to it centrally as needed and have
less mess. Fixes the sun2 build that needs rumpvfs after librump after
the latest changes.
 1.7 23-Jan-2016  christos branches: 1.7.16;
Define _KERNTYPES for things that need it.
 1.6 10-Jun-2014  he Fix static linking for the tests: -lrump is also used by -lrumpuser,
so we also need -lrump after -lrumpuser. Fixes build for sun2.
 1.5 25-Apr-2014  pooka obsolete the installed <rump/scsitest.h> header and make it private
to tests/dev/scsipi
 1.4 24-Apr-2014  pooka scsitest is a SCSI target emulator used by one test, and has little
reason to get installed. Make the component private to the test using
it and obsolete the installed one.

IOW, rename sys/rump/dev/lib/libscsitest -> tests/dev/scsipi/libscsitest
 1.3 11-Sep-2010  martin branches: 1.3.6; 1.3.12; 1.3.22;
Query the raw partition at runtime
 1.2 02-Sep-2010  he Re-order libraries so that this links statically as well.
 1.1 24-Aug-2010  pooka Test for cache sync noises after disk is ejected.

test case for PR kern/43785
 1.3.22.1 10-Aug-2014  tls Rebase.
 1.3.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.8 13-Jan-2017  christos Don't play with "../.." in includes for h_macros.h; deal with it centrally.
Minor fixes.
 1.7 25-Apr-2014  pooka branches: 1.7.6;
obsolete the installed <rump/scsitest.h> header and make it private
to tests/dev/scsipi
 1.6 15-Mar-2013  martin branches: 1.6.6;
The CD emulator has been fixed, no longer expect the test to die.
 1.5 14-Mar-2013  jmmv Expect a crash in the noisyeject test. Mention PR kern/47646.
 1.4 06-May-2012  martin branches: 1.4.2;
Comment out the expected failure, as it does not trigger anymore.
 1.3 27-Mar-2011  mlelstv branches: 1.3.4;
validate that getrawpartition() didn't fail.
 1.2 11-Sep-2010  martin Query the raw partition at runtime
 1.1 24-Aug-2010  pooka Test for cache sync noises after disk is ejected.

test case for PR kern/43785
 1.3.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.4.1 23-May-2012  yamt sync with head.
 1.4.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.2.1 23-Jun-2013  tls resync from head
 1.6.6.1 10-Aug-2014  tls Rebase.
 1.7.6.1 20-Mar-2017  pgoyette Sync with HEAD
 1.4 01-Jun-2020  christos LIBISPRIVATE=yes
 1.3 26-Apr-2014  christos branches: 1.3.2; 1.3.4; 1.3.8;
Include bsd.own.mk (hi pooka)
 1.2 25-Apr-2014  pooka CPPFLAGS for rump_private.h
 1.1 24-Apr-2014  pooka scsitest is a SCSI target emulator used by one test, and has little
reason to get installed. Make the component private to the test using
it and obsolete the installed one.

IOW, rename sys/rump/dev/lib/libscsitest -> tests/dev/scsipi/libscsitest
 1.3.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.8.1 26-Apr-2014  tls file Makefile was added on branch tls-maxphys on 2014-08-20 00:04:46 +0000
 1.3.4.2 10-Aug-2014  tls Rebase.
 1.3.4.1 26-Apr-2014  tls file Makefile was added on branch tls-earlyentropy on 2014-08-10 06:57:05 +0000
 1.3.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.2.1 26-Apr-2014  yamt file Makefile was added on branch yamt-pagecache on 2014-05-22 11:42:17 +0000
 1.1 24-Apr-2014  pooka branches: 1.1.2; 1.1.4; 1.1.8;
scsitest is a SCSI target emulator used by one test, and has little
reason to get installed. Make the component private to the test using
it and obsolete the installed one.

IOW, rename sys/rump/dev/lib/libscsitest -> tests/dev/scsipi/libscsitest
 1.1.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.8.1 24-Apr-2014  tls file SCSITEST.ioconf was added on branch tls-maxphys on 2014-08-20 00:04:46 +0000
 1.1.4.2 10-Aug-2014  tls Rebase.
 1.1.4.1 24-Apr-2014  tls file SCSITEST.ioconf was added on branch tls-earlyentropy on 2014-08-10 06:57:05 +0000
 1.1.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.2.1 24-Apr-2014  yamt file SCSITEST.ioconf was added on branch yamt-pagecache on 2014-05-22 11:42:17 +0000
 1.5 07-Aug-2021  cjep Convert the test to cfargs. OK @thorpej.
 1.4 25-Apr-2021  thorpej config_found_ia() -> config_found().
 1.3 06-Feb-2019  mrg use strncpy() into a buffer that may not be nul terminated.
 1.2 25-Apr-2014  pooka branches: 1.2.2; 1.2.4; 1.2.8; 1.2.30;
obsolete the installed <rump/scsitest.h> header and make it private
to tests/dev/scsipi
 1.1 24-Apr-2014  pooka scsitest is a SCSI target emulator used by one test, and has little
reason to get installed. Make the component private to the test using
it and obsolete the installed one.

IOW, rename sys/rump/dev/lib/libscsitest -> tests/dev/scsipi/libscsitest
 1.2.30.1 10-Jun-2019  christos Sync with HEAD
 1.2.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.8.1 25-Apr-2014  tls file scsitest.c was added on branch tls-maxphys on 2014-08-20 00:04:46 +0000
 1.2.4.2 10-Aug-2014  tls Rebase.
 1.2.4.1 25-Apr-2014  tls file scsitest.c was added on branch tls-earlyentropy on 2014-08-10 06:57:05 +0000
 1.2.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.2.1 25-Apr-2014  yamt file scsitest.c was added on branch yamt-pagecache on 2014-05-22 11:42:17 +0000
 1.1 25-Apr-2014  pooka branches: 1.1.2; 1.1.4; 1.1.8;
obsolete the installed <rump/scsitest.h> header and make it private
to tests/dev/scsipi
 1.1.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.8.1 25-Apr-2014  tls file scsitest.h was added on branch tls-maxphys on 2014-08-20 00:04:46 +0000
 1.1.4.2 10-Aug-2014  tls Rebase.
 1.1.4.1 25-Apr-2014  tls file scsitest.h was added on branch tls-earlyentropy on 2014-08-10 06:57:05 +0000
 1.1.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.2.1 25-Apr-2014  yamt file scsitest.h was added on branch yamt-pagecache on 2014-05-22 11:42:17 +0000
 1.1 24-Apr-2014  pooka branches: 1.1.2; 1.1.4; 1.1.8;
scsitest is a SCSI target emulator used by one test, and has little
reason to get installed. Make the component private to the test using
it and obsolete the installed one.

IOW, rename sys/rump/dev/lib/libscsitest -> tests/dev/scsipi/libscsitest
 1.1.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.8.1 24-Apr-2014  tls file scsitest_component.c was added on branch tls-maxphys on 2014-08-20 00:04:46 +0000
 1.1.4.2 10-Aug-2014  tls Rebase.
 1.1.4.1 24-Apr-2014  tls file scsitest_component.c was added on branch tls-earlyentropy on 2014-08-10 06:57:05 +0000
 1.1.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.2.1 24-Apr-2014  yamt file scsitest_component.c was added on branch yamt-pagecache on 2014-05-22 11:42:17 +0000
 1.5 01-Mar-2020  christos Centralize the base rump libraries into a variable used by all the other
Makefiles so that we can make changes to it centrally as needed and have
less mess. Fixes the sun2 build that needs rumpvfs after librump after
the latest changes.
 1.4 23-Jan-2016  christos branches: 1.4.16;
Define _KERNTYPES for things that need it.
 1.3 10-Jun-2014  he Fix static linking for the tests: -lrump is also used by -lrumpuser,
so we also need -lrump after -lrumpuser. Fixes build for sun2.
 1.2 20-Dec-2010  pgoyette branches: 1.2.12; 1.2.22;
Add a rump-based set of tests for sysmon_envsys(8) + powerd(8) + swsensor(4)
 1.1 06-Aug-2010  pooka Add test cases to check that sysmon/swwdog will panic and reboot
the kernel if left untickled.

Thanks to jmmv for the tip that doing this is possible in atf via
means of fork/wait.
 1.2.22.1 10-Aug-2014  tls Rebase.
 1.2.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.13 05-Dec-2021  msaitoh s/timout/timeout/
 1.12 13-Jun-2021  riastradh tests/dev/sysmon: Query bits of data, not bits of entropy.

Fixes PR kern/47661.
 1.11 21-Mar-2020  pgoyette These test cases should now succeed, after fixing rump kernel to handle
modules that establish their sysctls via SYSCTL_SETUP()
 1.10 19-Mar-2020  pgoyette Mark the swsensor tests "expected failure" since the rump world doesn't
seem to handle the SYSCTL_SETUP stuff. PR kern/55088
 1.9 23-Apr-2015  pgoyette Include better diagnostic info when a required key value cannot be retrieved from envstat -x
 1.8 27-Feb-2015  martin Double the timeout (to 120s) for slower machines
 1.7 14-Apr-2013  martin The sh api calls it atf_expect_fail, while the c api calls it
atf_tc_expect_fail - this is shell, so fix the names accordingly.
XXX Why do they differ?
 1.6 17-Mar-2013  jmmv These tests are flaky so mark them as expected failures... when they fail.
See PR kern/47661.
 1.5 19-Jul-2012  pgoyette branches: 1.5.2;
Add new test cases for entropy-providing sensors
 1.4 31-Dec-2010  pgoyette branches: 1.4.6;
Now that 'rump_server -l stuff' works, use a less heavyweight rump_server
for this test. Thanks, pooka!
 1.3 30-Dec-2010  pgoyette Now that we update the callout timer as soon as it is updated, we no longer
need to have an extended wait for the first powerd event to occur. Revert
that portion of previous commit.
 1.2 29-Dec-2010  pgoyette Various cleanup (most from pooka@)
- Does not require root access on the host, only in the rump
environment (which it gets by default)
- Manual clean-up of powerd process and rump-server socket is
not necessary - happens automatically
- Don't use a global, absolute path for the rump-server socket

For alarm_sensor, make sure events are still delivered after 'envstat -S'
(the cur_value was deliberately left at an alarm level and should not be
affected by the reset).

No longer need to skip the alarm_sensor and limit_sensor tests, since
pooka fixed passing of proplist to built-in modules.

Increase wait time for first powerd event report. (This should not be
needed, so there's probably a bug somewhere, but the increased timeout
lets us validate the rest of the sensor functionality.)
 1.1 20-Dec-2010  pgoyette Add a rump-based set of tests for sysmon_envsys(8) + powerd(8) + swsensor(4)
 1.4.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.6.1 30-Oct-2012  yamt sync with head
 1.5.2.1 23-Jun-2013  tls resync from head
 1.7 13-Jan-2017  christos Don't play with "../.." in includes for h_macros.h; deal with it centrally.
Minor fixes.
 1.6 23-Apr-2015  pgoyette branches: 1.6.2;
When exiting, provide a reason.
 1.5 26-Jun-2011  christos need signal.h for kill()
this is why it was wrong for rump_syscalls.h to include this.
 1.4 24-Oct-2010  pgoyette Due to timing discrepancies desribed in PR kern/43997, tickle the
watchdog just a little bit sooner. This maintains the spirit of the
test while avoiding the actual bug. This can be reverted once (if)
the PR is fixed.
 1.3 24-Oct-2010  pgoyette Add a third test-case to verify that disarming of the watchdog works.
 1.2 30-Aug-2010  pooka Make tcount volatile since a signal handler plays with it.
 1.1 06-Aug-2010  pooka Add test cases to check that sysmon/swwdog will panic and reboot
the kernel if left untickled.

Thanks to jmmv for the tip that doing this is possible in atf via
means of fork/wait.
 1.6.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.3 08-Jan-2016  jakllsch rework build of t_hid to be more reliable, while working around ATF cruddyness
 1.2 06-Jan-2016  christos Unbreak the sun2 build: Don't use program-specific LDADD options because
those come after the general LDADD options and break static linking.
 1.1 05-Jan-2016  jakllsch Add some tests for the kernel HID parser.
 1.1 01-Mar-2020  christos branches: 1.1.4;
fix build by adding a Makefile.inc that chains up.
 1.1.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.4.1 01-Mar-2020  martin file Makefile.inc was added on branch phil-wifi on 2020-04-08 14:09:06 +0000
 1.8 05-May-2016  jakllsch Use rump_schedule() before calling things in the rump context.
Hopefully fixes these tests on all ports.
 1.7 05-May-2016  jakllsch t_hid doesn't use rump correctly, and thus consistently fails; mark as such
 1.6 02-May-2016  jakllsch Call rump_init() before using rump functionality.

This change should make these test cases consistently fail on all ports.

Related to PR kern/51096.
 1.5 09-Jan-2016  jakllsch locate_item() doesn't need to have a flags argument, as the flags
are also in the hid item data structure.
 1.4 08-Jan-2016  jakllsch fix test program for hid item checks
 1.3 07-Jan-2016  jakllsch Don't crash when the device's HID Report Descriptor Pops from an empty stack.
 1.2 07-Jan-2016  jakllsch Add tests for HID Parser Pop-on-empty-stack bug.
 1.1 05-Jan-2016  jakllsch Add some tests for the kernel HID parser.
 1.3 01-Jun-2020  christos Set LIBISPRIVATE=yes
 1.2 10-Dec-2017  bouyer Fix fallout from hid factorisation:
- need to install sys/dev/hid/hid.h for userland
- include it where needed - most of the time in place if usb/usbhid.h
 1.1 05-Jan-2016  jakllsch Add some tests for the kernel HID parser.
 1.5 01-Mar-2020  christos fix build by adding a Makefile.inc that chains up.
 1.4 01-Mar-2020  christos Centralize the base rump libraries into a variable used by all the other
Makefiles so that we can make changes to it centrally as needed and have
less mess. Fixes the sun2 build that needs rumpvfs after librump after
the latest changes.
 1.3 01-Jun-2019  kre Deal with fallout from the addition of
KERN_PROC_CWD in sysctl(3)
That is kern.proc.$$.KERN_PROC_CWD (I think - not that it matters here)

The effect is that -lrump now requires -lrumpvfs

This set of changes fixes (I believe) regular dynamic builds,
more might be required for static builds (will be verified soon).
 1.2 10-Dec-2017  bouyer branches: 1.2.4;
Fix fallout from hid factorisation:
- need to install sys/dev/hid/hid.h for userland
- include it where needed - most of the time in place if usb/usbhid.h
 1.1 08-Jan-2016  jakllsch rework build of t_hid to be more reliable, while working around ATF cruddyness
 1.2.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.4.1 10-Jun-2019  christos Sync with HEAD

RSS XML Feed