<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/char/random.c, branch v3.15.2</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v3.15.2</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v3.15.2'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2014-05-17T02:18:22+00:00</updated>
<entry>
<title>random: fix BUG_ON caused by accounting simplification</title>
<updated>2014-05-17T02:18:22+00:00</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2014-05-17T01:40:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f9c6d4987b23e0a514464bae6771933a48e4cd01'/>
<id>urn:sha1:f9c6d4987b23e0a514464bae6771933a48e4cd01</id>
<content type='text'>
Commit ee1de406ba6eb1 ("random: simplify accounting logic") simplified
things too much, in that it allows the following to trigger an
overflow that results in a BUG_ON crash:

dd if=/dev/urandom of=/dev/zero bs=67108707 count=1

Thanks to Peter Zihlstra for discovering the crash, and Hannes
Frederic for analyizing the root cause.

Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Reported-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Reported-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Cc: Greg Price &lt;price@mit.edu&gt;
</content>
</entry>
<entry>
<title>random: Add arch_has_random[_seed]()</title>
<updated>2014-03-20T02:24:08+00:00</updated>
<author>
<name>H. Peter Anvin</name>
<email>hpa@linux.intel.com</email>
</author>
<published>2014-03-17T23:36:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7b878d4b48c4e04b936918bb83836a107ba453b3'/>
<id>urn:sha1:7b878d4b48c4e04b936918bb83836a107ba453b3</id>
<content type='text'>
Add predicate functions for having arch_get_random[_seed]*().  The
only current use is to avoid the loop in arch_random_refill() when
arch_get_random_seed_long() is unavailable.

Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Michael Ellerman &lt;michael@ellerman.id.au&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>random: If we have arch_get_random_seed*(), try it before blocking</title>
<updated>2014-03-20T02:22:06+00:00</updated>
<author>
<name>H. Peter Anvin</name>
<email>hpa@linux.intel.com</email>
</author>
<published>2014-03-17T23:36:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=331c6490c7f10dcf263712e313b7c0bc7fb6d77a'/>
<id>urn:sha1:331c6490c7f10dcf263712e313b7c0bc7fb6d77a</id>
<content type='text'>
If we have arch_get_random_seed*(), try to use it for emergency refill
of the entropy pool before giving up and blocking on /dev/random.  It
may or may not work in the moment, but if it does work, it will give
the user better service than blocking will.

Reviewed-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>random: Use arch_get_random_seed*() at init time and once a second</title>
<updated>2014-03-20T02:22:06+00:00</updated>
<author>
<name>H. Peter Anvin</name>
<email>hpa@linux.intel.com</email>
</author>
<published>2014-03-17T23:36:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=83664a6928a420b5ccfc0cf23ddbfe3634fea271'/>
<id>urn:sha1:83664a6928a420b5ccfc0cf23ddbfe3634fea271</id>
<content type='text'>
Use arch_get_random_seed*() in two places in the Linux random
driver (drivers/char/random.c):

1. During entropy pool initialization, use RDSEED in favor of RDRAND,
   with a fallback to the latter.  Entropy exhaustion is unlikely to
   happen there on physical hardware as the machine is single-threaded
   at that point, but could happen in a virtual machine.  In that
   case, the fallback to RDRAND will still provide more than adequate
   entropy pool initialization.

2. Once a second, issue RDSEED and, if successful, feed it to the
   entropy pool.  To ensure an extra layer of security, only credit
   half the entropy just in case.

Suggested-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Reviewed-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>random: use the architectural HWRNG for the SHA's IV in extract_buf()</title>
<updated>2014-03-20T02:18:52+00:00</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2013-12-18T02:16:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=46884442fc5bb81a896f7245bd850fde9b435509'/>
<id>urn:sha1:46884442fc5bb81a896f7245bd850fde9b435509</id>
<content type='text'>
To help assuage the fears of those who think the NSA can introduce a
massive hack into the instruction decode and out of order execution
engine in the CPU without hundreds of Intel engineers knowing about
it (only one of which woud need to have the conscience and courage of
Edward Snowden to spill the beans to the public), use the HWRNG to
initialize the SHA starting value, instead of xor'ing it in
afterwards.

Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>random: clarify bits/bytes in wakeup thresholds</title>
<updated>2014-03-20T02:18:51+00:00</updated>
<author>
<name>Greg Price</name>
<email>price@MIT.EDU</email>
</author>
<published>2013-12-07T02:28:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2132a96f66b6b4d865113e7d4cb56d5f7c6e3cdf'/>
<id>urn:sha1:2132a96f66b6b4d865113e7d4cb56d5f7c6e3cdf</id>
<content type='text'>
These are a recurring cause of confusion, so rename them to
hopefully be clearer.

Signed-off-by: Greg Price &lt;price@mit.edu&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>random: entropy_bytes is actually bits</title>
<updated>2014-03-20T02:18:51+00:00</updated>
<author>
<name>Greg Price</name>
<email>price@MIT.EDU</email>
</author>
<published>2013-12-07T14:49:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7d1b08c40c4f02c119476b29eca9bbc8d98d2a83'/>
<id>urn:sha1:7d1b08c40c4f02c119476b29eca9bbc8d98d2a83</id>
<content type='text'>
The variable 'entropy_bytes' is set from an expression that actually
counts bits.  Fortunately it's also only compared to values that also
count bits.  Rename it accordingly.

Signed-off-by: Greg Price &lt;price@mit.edu&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>random: simplify accounting code</title>
<updated>2014-03-20T02:18:51+00:00</updated>
<author>
<name>Greg Price</name>
<email>price@MIT.EDU</email>
</author>
<published>2013-12-06T00:32:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0fb7a01af5b0cbe5bf365891fc4d186f2caa23f7'/>
<id>urn:sha1:0fb7a01af5b0cbe5bf365891fc4d186f2caa23f7</id>
<content type='text'>
With this we handle "reserved" in just one place.  As a bonus the
code becomes less nested, and the "wakeup_write" flag variable
becomes unnecessary.  The variable "flags" was already unused.

This code behaves identically to the previous version except in
two pathological cases that don't occur.  If the argument "nbytes"
is already less than "min", then we didn't previously enforce
"min".  If r-&gt;limit is false while "reserved" is nonzero, then we
previously applied "reserved" in checking whether we had enough
bits, even though we don't apply it to actually limit how many we
take.  The callers of account() never exercise either of these cases.

Before the previous commit, it was possible for "nbytes" to be less
than "min" if userspace chose a pathological configuration, but no
longer.

Cc: Jiri Kosina &lt;jkosina@suse.cz&gt;
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Signed-off-by: Greg Price &lt;price@mit.edu&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>random: tighten bound on random_read_wakeup_thresh</title>
<updated>2014-03-20T02:18:51+00:00</updated>
<author>
<name>Greg Price</name>
<email>price@MIT.EDU</email>
</author>
<published>2013-12-06T00:19:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8c2aa3390ebb59cba4495a56557b70ad0575eef5'/>
<id>urn:sha1:8c2aa3390ebb59cba4495a56557b70ad0575eef5</id>
<content type='text'>
We use this value in a few places other than its literal meaning,
in particular in _xfer_secondary_pool() as a minimum number of
bits to pull from the input pool at a time into either output
pool.  It doesn't make sense to pull more bits than the whole size
of an output pool.

We could and possibly should separate the quantities "how much
should the input pool have to have to wake up /dev/random readers"
and "how much should we transfer from the input to an output pool
at a time", but nobody is likely to be sad they can't set the first
quantity to more than 1024 bits, so for now just limit them both.

Signed-off-by: Greg Price &lt;price@mit.edu&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>random: forget lock in lockless accounting</title>
<updated>2014-03-20T02:18:51+00:00</updated>
<author>
<name>Greg Price</name>
<email>price@MIT.EDU</email>
</author>
<published>2013-11-30T01:09:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a58aa4edc6d2e779894b1fa95a2f4de157ff3b3b'/>
<id>urn:sha1:a58aa4edc6d2e779894b1fa95a2f4de157ff3b3b</id>
<content type='text'>
The only mutable data accessed here is -&gt;entropy_count, but since
10b3a32d2 ("random: fix accounting race condition") we use cmpxchg to
protect our accesses to -&gt;entropy_count here.  Drop the use of the
lock.

Cc: Jiri Kosina &lt;jkosina@suse.cz&gt;
Signed-off-by: Greg Price &lt;price@mit.edu&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
</content>
</entry>
</feed>
