@@ -114,22 +114,22 @@ the read result via bind mounting another file on top of
114
114
important, bind mount another file on top of it.
115
115
* If microVMs run on machines with IvyBridge or newer Intel processors
116
116
(which provide RDRAND; in addition, RDSEED is offered starting with
117
- Broadwell), and the noise implicitly added when random values are
118
- generated is considered sufficient, then nothing else has to be done .
119
- * Otherwise , the conservative approach is to do the following (before
120
- customer code continues its run in the clone):
117
+ Broadwell). Hardware supported reseeding is done on a cadence defined
118
+ by the Linux Kernel and should be sufficient for most cases .
119
+ * To be as safe as possible , the direct approach is to do the following (before
120
+ customer code is resumed in the clone):
121
121
1 . Open one of the special devices files (either ` /dev/random ` or
122
- ` /dev/urandom ` ).
123
- 1 . Issue an ` RNDCLEARPOOL ioctl ` (requires ` CAP_SYS_ADMIN ` ). This
124
- clears and sets the entropy pools to the initial state. Should also
125
- cause the reinitialization of the ` /dev/urandom ` ` CSPRNG ` .
126
- 1 . Issue an ` RNDADDENTROPY ioctl ` (requires ` CAP_SYS_ADMIN ` ) to mix
127
- the provided bytes into the input entropy pool and increase the
128
- entropy count. This should also cause the ` /dev/urandom ` ` CSPRNG `
129
- to be reseeded. The bytes can be generated locally in the guest,
130
- or obtained from the host. Starting with version 4.17 of the
131
- kernel, there’s a new ioctl request ( ` RNDRESEEDCRNG ` ) that
132
- specifically causes the ` CSPRNG ` to be reseeded from the input pool.
122
+ ` /dev/urandom ` ). Take note that ` RNDCLEARPOOL ` no longer
123
+ [ has any effect ] [ 7 ] on the entropy pool.
124
+ 1 . Issue an ` RNDADDENTROPY ` ioctl call (requires ` CAP_SYS_ADMIN ` )
125
+ to mix the provided bytes into the input
126
+ entropy pool and increase the entropy count.
127
+ This should also cause the ` /dev/urandom ` ` CSPRNG `
128
+ to be reseeded. The bytes can be generated locally in the guest,
129
+ or obtained from the host.
130
+ 1 . Issue a ` RNDRESEEDCRNG ` ioctl call
131
+ ( [ 4.14 ] [ 5 ] , [ 5.10 ] [ 6 ] , (requires ` CAP_SYS_ADMIN ` )) that specifically
132
+ causes the ` CSPRNG ` to be reseeded from the input pool.
133
133
134
134
** Annex 1 contains the source code of a C program which implements the
135
135
previous three steps.** As soon as the guest kernel version switches to
@@ -219,3 +219,6 @@ int main(int argc, char ** argv) {
219
219
[2]: https://www.2uo.de/myths-about-urandom
220
220
[3]: https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publications/Studies/LinuxRNG/LinuxRNG_EN.pdf
221
221
[4]: http://man7.org/linux/man-pages/man4/random.4.html
222
+ [5]: https://elixir.bootlin.com/linux/v4.14.295/source/drivers/char/random.c#L1355
223
+ [6]: https://elixir.bootlin.com/linux/v5.10.147/source/drivers/char/random.c#L1360
224
+ [7]: https://elixir.bootlin.com/linux/v4.14.295/source/drivers/char/random.c#L1351
0 commit comments