<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/char/hw_random/core.c, branch linux-5.3.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.3.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.3.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2019-10-05T13:12:36Z</updated>
<entry>
<title>hwrng: core - don't wait on add_early_randomness()</title>
<updated>2019-10-05T13:12: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=f3ffa1e89901609d27dc4384188b708ca416138c'/>
<id>urn:sha1:f3ffa1e89901609d27dc4384188b708ca416138c</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>docs: admin-guide: add a series of orphaned documents</title>
<updated>2019-07-15T14:03:02Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
</author>
<published>2019-06-27T17:56:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4f4cfa6c560c93ba180c30675cf845e1597de44c'/>
<id>urn:sha1:4f4cfa6c560c93ba180c30675cf845e1597de44c</id>
<content type='text'>
There are lots of documents that belong to the admin-guide but
are on random places (most under Documentation root dir).

Move them to the admin guide.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+samsung@kernel.org&gt;
Acked-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
Acked-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
</content>
</entry>
<entry>
<title>hwrng: core - document the quality field</title>
<updated>2018-10-05T02:16:56Z</updated>
<author>
<name>Michael S. Tsirkin</name>
</author>
<published>2018-09-25T16:35:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fae29f135ef4a86228d3ce13b61babf0d3031118'/>
<id>urn:sha1:fae29f135ef4a86228d3ce13b61babf0d3031118</id>
<content type='text'>
quality field is currently documented as being 'per mill'.  In fact the
math involved is:

                add_hwgenerator_randomness((void *)rng_fillbuf, rc,
                                           rc * current_quality * 8 &gt;&gt; 10);

thus the actual definition is "bits of entropy per 1024 bits of input".

The current documentation seems to have confused multiple people
in the past, let's fix the documentation to match code.

An alternative is to change core to match driver expectations, replacing
	rc * current_quality * 8 &gt;&gt; 10
with
	rc * current_quality / 1000
but that has performance costs, so probably isn't a good option.

Fixes: 0f734e6e768 ("hwrng: add per-device entropy derating")
Reported-by: "Dr. David Alan Gilbert" &lt;dgilbert@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>hwrng: core - Always drop the RNG in hwrng_unregister()</title>
<updated>2018-06-15T15:06:49Z</updated>
<author>
<name>Michael Büsch</name>
</author>
<published>2018-06-14T18:08:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=837bf7cc3b7504385ae0e829c72e470dfc27cf6c'/>
<id>urn:sha1:837bf7cc3b7504385ae0e829c72e470dfc27cf6c</id>
<content type='text'>
enable_best_rng() is used in hwrng_unregister() to switch away from the
currently active RNG, if that is the one currently being removed.
However enable_best_rng() might fail, if the next RNG's init routine
fails. In that case enable_best_rng() will return an error code and
the currently active RNG will remain active.
After unregistering this might lead to crashes due to use-after-free.

Fix this by dropping the currently active RNG, if enable_best_rng()
failed. This will result in no RNG to be active, if the next-best
one failed to initialize.

This problem was introduced by 142a27f0a731ddcf467546960a5585970ca98e21

Fixes: 142a27f0a731 ("hwrng: core - Reset user selected rng by...")
Reported-by: Wirz &lt;spam@lukas-wirz.de&gt;
Tested-by: Wirz &lt;spam@lukas-wirz.de&gt;
Signed-off-by: Michael Büsch &lt;m@bues.ch&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>hwrng: core - Clean up RNG list when last hwrng is unregistered</title>
<updated>2017-12-22T09:03:36Z</updated>
<author>
<name>Gary R Hook</name>
</author>
<published>2017-12-15T19:55:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0e4b52942b1c76f89e0dcb829f72e123d0678f54'/>
<id>urn:sha1:0e4b52942b1c76f89e0dcb829f72e123d0678f54</id>
<content type='text'>
Commit 142a27f0a731 added support for a "best" RNG, and in doing so
introduced a hang from rmmod/modprobe -r when the last RNG on the list
was unloaded.

When the hwrng list is depleted, return the global variables to their
original state and decrement all references to the object.

Fixes: 142a27f0a731 ("hwrng: core - Reset user selected rng by writing "" to rng_current")
Signed-off-by: Gary R Hook &lt;gary.hook@amd.com&gt;
Reviewed-by: PrasannaKumar Muralidharan &lt;prasannatsmkumar@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>hwrng: core - Reset user selected rng by writing "" to rng_current</title>
<updated>2017-11-03T14:11:25Z</updated>
<author>
<name>PrasannaKumar Muralidharan</name>
</author>
<published>2017-10-27T17:04:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=142a27f0a731ddcf467546960a5585970ca98e21'/>
<id>urn:sha1:142a27f0a731ddcf467546960a5585970ca98e21</id>
<content type='text'>
User is able to select a chosen rng by writing its name to rng_current
but there is no way to reset it without unbinding the rng. Let user
write "" to rng_current and delesect the chosen rng.

Signed-off-by: PrasannaKumar Muralidharan &lt;prasannatsmkumar@gmail.com&gt;
reviewed-by: Harald Freudenberger &lt;freude@linux.vnet.ibm.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>hwrng: core - pr_err() strings should end with newlines</title>
<updated>2017-10-12T14:54:49Z</updated>
<author>
<name>Arvind Yadav</name>
</author>
<published>2017-09-25T07:45:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4d0ec22943301f827ac2800b7eb3531fb6d7447b'/>
<id>urn:sha1:4d0ec22943301f827ac2800b7eb3531fb6d7447b</id>
<content type='text'>
pr_err() messages should terminated with a new-line to avoid
other messages being concatenated onto the end.

Signed-off-by: Arvind Yadav &lt;arvind.yadav.cs@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>hwrng: remember rng chosen by user</title>
<updated>2017-07-18T10:16:09Z</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=10a515ddb5f19a1ff0b9882c430b4427843169f3'/>
<id>urn:sha1:10a515ddb5f19a1ff0b9882c430b4427843169f3</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>hwrng: use rng source with best quality</title>
<updated>2017-07-18T10:16:08Z</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=2bbb6983887fefc8026beab01198d30f47b7bd22'/>
<id>urn:sha1:2bbb6983887fefc8026beab01198d30f47b7bd22</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>sched/headers: Prepare to move signal wakeup &amp; sigpending methods from &lt;linux/sched.h&gt; into &lt;linux/sched/signal.h&gt;</title>
<updated>2017-03-02T07:42:32Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2017-02-02T18:15:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=174cd4b1e5fbd0d74c68cf3a74f5bd4923485512'/>
<id>urn:sha1:174cd4b1e5fbd0d74c68cf3a74f5bd4923485512</id>
<content type='text'>
Fix up affected files that include this signal functionality via sched.h.

Acked-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Mike Galbraith &lt;efault@gmx.de&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
</feed>
