<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/char/hw_random/core.c, branch linux-4.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-06-25T09:45:10Z</updated>
<entry>
<title>random: pull add_hwgenerator_randomness() declaration into random.h</title>
<updated>2022-06-25T09:45:10Z</updated>
<author>
<name>Jason A. Donenfeld</name>
</author>
<published>2022-02-13T15:17:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=75cc37f461de9f8a80aa381ee882cf70822ee4a2'/>
<id>urn:sha1:75cc37f461de9f8a80aa381ee882cf70822ee4a2</id>
<content type='text'>
commit b777c38239fec5a528e59f55b379e31b1a187524 upstream.

add_hwgenerator_randomness() is a function implemented and documented
inside of random.c. It is the way that hardware RNGs push data into it.
Therefore, it should be declared in random.h. Otherwise sparse complains
with:

random.c:1137:6: warning: symbol 'add_hwgenerator_randomness' was not declared. Should it be static?

The alternative would be to include hw_random.h into random.c, but that
wouldn't really be good for anything except slowing down compile time.

Cc: Matt Mackall &lt;mpm@selenic.com&gt;
Cc: Theodore Ts'o &lt;tytso@mit.edu&gt;
Acked-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Reviewed-by: Eric Biggers &lt;ebiggers@google.com&gt;
Reviewed-by: Dominik Brodowski &lt;linux@dominikbrodowski.net&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>hwrng: remember rng chosen by user</title>
<updated>2022-06-25T09:45:10Z</updated>
<author>
<name>Harald Freudenberger</name>
</author>
<published>2017-07-11T07:36:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f6b013eedc72c417a3e5afa1ad0204d8c38e8c29'/>
<id>urn:sha1:f6b013eedc72c417a3e5afa1ad0204d8c38e8c29</id>
<content type='text'>
commit 10a515ddb5f19a1ff0b9882c430b4427843169f3 upstream.

When a user chooses a rng source via sysfs attribute
this rng should be sticky, even when other sources
with better quality to register. This patch introduces
a simple way to remember the user's choice. This is
reflected by a new sysfs attribute file 'rng_selected'
which shows if the current rng has been chosen by
userspace. The new attribute file shows '1' for user
selected rng and '0' otherwise.

Signed-off-by: Harald Freudenberger &lt;freude@linux.vnet.ibm.com&gt;
Reviewed-by: PrasannaKumar Muralidharan &lt;prasannatsmkumar@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>hwrng: use rng source with best quality</title>
<updated>2022-06-25T09:45:10Z</updated>
<author>
<name>Harald Freudenberger</name>
</author>
<published>2017-07-11T07:36:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=42802952a2725f85f7e36ee3b29593af5fe87197'/>
<id>urn:sha1:42802952a2725f85f7e36ee3b29593af5fe87197</id>
<content type='text'>
commit 2bbb6983887fefc8026beab01198d30f47b7bd22 upstream.

This patch rewoks the hwrng to always use the
rng source with best entropy quality.

On registation and unregistration the hwrng now
tries to choose the best (= highest quality value)
rng source. The handling of the internal list
of registered rng sources is now always sorted
by quality and the top most rng chosen.

Signed-off-by: Harald Freudenberger &lt;freude@linux.vnet.ibm.com&gt;
Reviewed-by: PrasannaKumar Muralidharan &lt;prasannatsmkumar@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>hwrng: core - remove unused PFX macro</title>
<updated>2022-06-25T09:45:10Z</updated>
<author>
<name>Corentin LABBE</name>
</author>
<published>2016-12-13T14:51:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=675d99b9f31db68bb5c23654297a8c6ff4cf11f6'/>
<id>urn:sha1:675d99b9f31db68bb5c23654297a8c6ff4cf11f6</id>
<content type='text'>
commit 079840bd13f793b915f6c8e44452eeb4a0aba8ba upstream.

This patch remove the unused PFX macro.

Signed-off-by: Corentin Labbe &lt;clabbe.montjoie@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>hwrng: core - Move hwrng miscdev minor number to include/linux/miscdevice.h</title>
<updated>2022-06-25T09:45:10Z</updated>
<author>
<name>Corentin LABBE</name>
</author>
<published>2016-12-13T14:51:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2de01a4b424e3f9bf9d5f7aa46c7e69aabb8e183'/>
<id>urn:sha1:2de01a4b424e3f9bf9d5f7aa46c7e69aabb8e183</id>
<content type='text'>
commit fd50d71f94fb1c8614098949db068cd4c8dbb91d upstream.

This patch move the define for hwrng's miscdev minor number to
include/linux/miscdevice.h.
It's better that all minor number are in the same place.
Rename it to HWRNG_MINOR (from RNG_MISCDEV_MINOR) in he process since
no other miscdev define have MISCDEV in their name.

Signed-off-by: Corentin Labbe &lt;clabbe.montjoie@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>hwrng: core - Rewrite the header</title>
<updated>2022-06-25T09:45:10Z</updated>
<author>
<name>Corentin LABBE</name>
</author>
<published>2016-12-13T14:51:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=62f50335a68073b7b88aec32ef93bdf93400107e'/>
<id>urn:sha1:62f50335a68073b7b88aec32ef93bdf93400107e</id>
<content type='text'>
commit dd8014830d2b1fdf5328978ada706df3ec180c21 upstream.

checkpatch have lot of complaint about header.
Furthermore, the header have some offtopic/useless information.

This patch rewrite a proper header.

Signed-off-by: Corentin Labbe &lt;clabbe.montjoie@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>hwrng: core - rewrite better comparison to NULL</title>
<updated>2022-06-25T09:45:10Z</updated>
<author>
<name>Corentin LABBE</name>
</author>
<published>2016-12-13T14:51:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=836e91b6c9db8bde0cc02f14e17ad3477c7d8284'/>
<id>urn:sha1:836e91b6c9db8bde0cc02f14e17ad3477c7d8284</id>
<content type='text'>
commit 2a971e3b248775f808950bdc0ac75f12a2853eff upstream.

This patch fix the checkpatch warning "Comparison to NULL could be written "!ptr"

Signed-off-by: Corentin Labbe &lt;clabbe.montjoie@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>hwrng: core - do not use multiple blank lines</title>
<updated>2022-06-25T09:45:09Z</updated>
<author>
<name>Corentin LABBE</name>
</author>
<published>2016-12-13T14:51:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e1b293341cc3bea31b07e07f76adcbeab37ebe43'/>
<id>urn:sha1:e1b293341cc3bea31b07e07f76adcbeab37ebe43</id>
<content type='text'>
commit 6bc17d90e62d16828d1a2113b54cfa4e04582fb6 upstream.

This patch fix the checkpatch warning "Please don't use multiple blank lines"

Signed-off-by: Corentin Labbe &lt;clabbe.montjoie@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>hwrng: core - don't wait on add_early_randomness()</title>
<updated>2019-10-05T10:30:36Z</updated>
<author>
<name>Laurent Vivier</name>
</author>
<published>2019-09-17T09:54:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a4ded68dddba421f33f9e483892fb3c0a3834196'/>
<id>urn:sha1:a4ded68dddba421f33f9e483892fb3c0a3834196</id>
<content type='text'>
commit 78887832e76541f77169a24ac238fccb51059b63 upstream.

add_early_randomness() is called by hwrng_register() when the
hardware is added. If this hardware and its module are present
at boot, and if there is no data available the boot hangs until
data are available and can't be interrupted.

For instance, in the case of virtio-rng, in some cases the host can be
not able to provide enough entropy for all the guests.

We can have two easy ways to reproduce the problem but they rely on
misconfiguration of the hypervisor or the egd daemon:

- if virtio-rng device is configured to connect to the egd daemon of the
host but when the virtio-rng driver asks for data the daemon is not
connected,

- if virtio-rng device is configured to connect to the egd daemon of the
host but the egd daemon doesn't provide data.

The guest kernel will hang at boot until the virtio-rng driver provides
enough data.

To avoid that, call rng_get_data() in non-blocking mode (wait=0)
from add_early_randomness().

Signed-off-by: Laurent Vivier &lt;lvivier@redhat.com&gt;
Fixes: d9e797261933 ("hwrng: add randomness to system from rng...")
Cc: &lt;stable@vger.kernel.org&gt;
Reviewed-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>hwrng: core - Don't use a stack buffer in add_early_randomness()</title>
<updated>2016-10-19T03:20:21Z</updated>
<author>
<name>Andrew Lutomirski</name>
</author>
<published>2016-10-17T17:06:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6d4952d9d9d4dc2bb9c0255d95a09405a1e958f7'/>
<id>urn:sha1:6d4952d9d9d4dc2bb9c0255d95a09405a1e958f7</id>
<content type='text'>
hw_random carefully avoids using a stack buffer except in
add_early_randomness().  This causes a crash in virtio_rng if
CONFIG_VMAP_STACK=y.

Reported-by: Matt Mullins &lt;mmullins@mmlx.us&gt;
Tested-by: Matt Mullins &lt;mmullins@mmlx.us&gt;
Fixes: d3cc7996473a ("hwrng: fetch randomness only after device init")
Signed-off-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
</feed>
