<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/char/random.c, branch v3.0.81</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/char/random.c?h=v3.0.81</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/char/random.c?h=v3.0.81'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-08-15T19:04:29Z</updated>
<entry>
<title>random: mix in architectural randomness in extract_buf()</title>
<updated>2012-08-15T19:04:29Z</updated>
<author>
<name>H. Peter Anvin</name>
<email>hpa@linux.intel.com</email>
</author>
<published>2012-07-28T02:26:08Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9f6082404e1d17ea7a9745c141dd91dba2102c57'/>
<id>urn:sha1:9f6082404e1d17ea7a9745c141dd91dba2102c57</id>
<content type='text'>
commit d2e7c96af1e54b507ae2a6a7dd2baf588417a7e5 upstream.

Mix in any architectural randomness in extract_buf() instead of
xfer_secondary_buf().  This allows us to mix in more architectural
randomness, and it also makes xfer_secondary_buf() faster, moving a
tiny bit of additional CPU overhead to process which is extracting the
randomness.

[ Commit description modified by tytso to remove an extended
  advertisement for the RDRAND instruction. ]

Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
Acked-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: DJ Johnston &lt;dj.johnston@intel.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>random: Add comment to random_initialize()</title>
<updated>2012-08-15T19:04:29Z</updated>
<author>
<name>Tony Luck</name>
<email>tony.luck@intel.com</email>
</author>
<published>2012-07-23T16:47:57Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=dbbdd2bb89716814a5336105d8b3e6fd64ff0886'/>
<id>urn:sha1:dbbdd2bb89716814a5336105d8b3e6fd64ff0886</id>
<content type='text'>
commit cbc96b7594b5691d61eba2db8b2ea723645be9ca upstream.

Many platforms have per-machine instance data (serial numbers,
asset tags, etc.) squirreled away in areas that are accessed
during early system bringup. Mixing this data into the random
pools has a very high value in providing better random data,
so we should allow (and even encourage) architecture code to
call add_device_randomness() from the setup_arch() paths.

However, this limits our options for internal structure of
the random driver since random_initialize() is not called
until long after setup_arch().

Add a big fat comment to rand_initialize() spelling out
this requirement.

Suggested-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>random: remove rand_initialize_irq()</title>
<updated>2012-08-15T19:04:28Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2012-07-15T00:27:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b6b847a93be87fc9974d8232984668a5a59754df'/>
<id>urn:sha1:b6b847a93be87fc9974d8232984668a5a59754df</id>
<content type='text'>
commit c5857ccf293968348e5eb4ebedc68074de3dcda6 upstream.

With the new interrupt sampling system, we are no longer using the
timer_rand_state structure in the irq descriptor, so we can stop
initializing it now.

[ Merged in fixes from Sedat to find some last missing references to
  rand_initialize_irq() ]

Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Signed-off-by: Sedat Dilek &lt;sedat.dilek@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>random: add tracepoints for easier debugging and verification</title>
<updated>2012-08-15T19:04:13Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2012-07-04T20:19:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1edbd889fa5c0343d817ae6fe44ab95870a096b4'/>
<id>urn:sha1:1edbd889fa5c0343d817ae6fe44ab95870a096b4</id>
<content type='text'>
commit 00ce1db1a634746040ace24c09a4e3a7949a3145 upstream.

Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>random: add new get_random_bytes_arch() function</title>
<updated>2012-08-15T19:04:13Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2012-07-05T14:35:23Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=efe6c422db90b8303bfaf7fc2131bb2824a06c39'/>
<id>urn:sha1:efe6c422db90b8303bfaf7fc2131bb2824a06c39</id>
<content type='text'>
commit c2557a303ab6712bb6e09447df828c557c710ac9 upstream.

Create a new function, get_random_bytes_arch() which will use the
architecture-specific hardware random number generator if it is
present.  Change get_random_bytes() to not use the HW RNG, even if it
is avaiable.

The reason for this is that the hw random number generator is fast (if
it is present), but it requires that we trust the hardware
manufacturer to have not put in a back door.  (For example, an
increasing counter encrypted by an AES key known to the NSA.)

It's unlikely that Intel (for example) was paid off by the US
Government to do this, but it's impossible for them to prove otherwise
  --- especially since Bull Mountain is documented to use AES as a
whitener.  Hence, the output of an evil, trojan-horse version of
RDRAND is statistically indistinguishable from an RDRAND implemented
to the specifications claimed by Intel.  Short of using a tunnelling
electronic microscope to reverse engineer an Ivy Bridge chip and
disassembling and analyzing the CPU microcode, there's no way for us
to tell for sure.

Since users of get_random_bytes() in the Linux kernel need to be able
to support hardware systems where the HW RNG is not present, most
time-sensitive users of this interface have already created their own
cryptographic RNG interface which uses get_random_bytes() as a seed.
So it's much better to use the HW RNG to improve the existing random
number generator, by mixing in any entropy returned by the HW RNG into
/dev/random's entropy pool, but to always _use_ /dev/random's entropy
pool.

This way we get almost of the benefits of the HW RNG without any
potential liabilities.  The only benefits we forgo is the
speed/performance enhancements --- and generic kernel code can't
depend on depend on get_random_bytes() having the speed of a HW RNG
anyway.

For those places that really want access to the arch-specific HW RNG,
if it is available, we provide get_random_bytes_arch().

Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>random: use the arch-specific rng in xfer_secondary_pool</title>
<updated>2012-08-15T19:04:13Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2012-07-05T14:21:01Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b2b6f1202d6f948bfe8d280dec83da1fef05a05c'/>
<id>urn:sha1:b2b6f1202d6f948bfe8d280dec83da1fef05a05c</id>
<content type='text'>
commit e6d4947b12e8ad947add1032dd754803c6004824 upstream.

If the CPU supports a hardware random number generator, use it in
xfer_secondary_pool(), where it will significantly improve things and
where we can afford it.

Also, remove the use of the arch-specific rng in
add_timer_randomness(), since the call is significantly slower than
get_cycles(), and we're much better off using it in
xfer_secondary_pool() anyway.

Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>random: create add_device_randomness() interface</title>
<updated>2012-08-15T19:04:12Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2012-07-04T15:16:01Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=3e035335b0578f6a058aecaf817b462ec9773c24'/>
<id>urn:sha1:3e035335b0578f6a058aecaf817b462ec9773c24</id>
<content type='text'>
commit a2080a67abe9e314f9e9c2cc3a4a176e8a8f8793 upstream.

Add a new interface, add_device_randomness() for adding data to the
random pool that is likely to differ between two devices (or possibly
even per boot).  This would be things like MAC addresses or serial
numbers, or the read-out of the RTC. This does *not* add any actual
entropy to the pool, but it initializes the pool to different values
for devices that might otherwise be identical and have very little
entropy available to them (particularly common in the embedded world).

[ Modified by tytso to mix in a timestamp, since there may be some
  variability caused by the time needed to detect/configure the hardware
  in question. ]

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>random: use lockless techniques in the interrupt path</title>
<updated>2012-08-15T19:04:12Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2012-07-04T14:38:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ebb6006e3be88bb15328887dec4a8c3b7c0138b6'/>
<id>urn:sha1:ebb6006e3be88bb15328887dec4a8c3b7c0138b6</id>
<content type='text'>
commit 902c098a3663de3fa18639efbb71b6080f0bcd3c upstream.

The real-time Linux folks don't like add_interrupt_randomness() taking
a spinlock since it is called in the low-level interrupt routine.
This also allows us to reduce the overhead in the fast path, for the
random driver, which is the interrupt collection path.

Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>random: make 'add_interrupt_randomness()' do something sane</title>
<updated>2012-08-15T19:04:12Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2012-07-02T11:52:16Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=aa88dea2270f685349ab7b92169600452fe73b62'/>
<id>urn:sha1:aa88dea2270f685349ab7b92169600452fe73b62</id>
<content type='text'>
commit 775f4b297b780601e61787b766f306ed3e1d23eb upstream.

We've been moving away from add_interrupt_randomness() for various
reasons: it's too expensive to do on every interrupt, and flooding the
CPU with interrupts could theoretically cause bogus floods of entropy
from a somewhat externally controllable source.

This solves both problems by limiting the actual randomness addition
to just once a second or after 64 interrupts, whicever comes first.
During that time, the interrupt cycle data is buffered up in a per-cpu
pool.  Also, we make sure the the nonblocking pool used by urandom is
initialized before we start feeding the normal input pool.  This
assures that /dev/urandom is returning unpredictable data as soon as
possible.

(Based on an original patch by Linus, but significantly modified by
tytso.)

Tested-by: Eric Wustrow &lt;ewust@umich.edu&gt;
Reported-by: Eric Wustrow &lt;ewust@umich.edu&gt;
Reported-by: Nadia Heninger &lt;nadiah@cs.ucsd.edu&gt;
Reported-by: Zakir Durumeric &lt;zakir@umich.edu&gt;
Reported-by: J. Alex Halderman &lt;jhalderm@umich.edu&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>drivers/char/random.c: fix boot id uniqueness race</title>
<updated>2012-08-15T19:04:12Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2012-04-12T19:49:12Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f5a1367c1bc150e70e8db9bb6f2892e8e31648c7'/>
<id>urn:sha1:f5a1367c1bc150e70e8db9bb6f2892e8e31648c7</id>
<content type='text'>
commit 44e4360fa3384850d65dd36fb4e6e5f2f112709b upstream.

/proc/sys/kernel/random/boot_id can be read concurrently by userspace
processes.  If two (or more) user-space processes concurrently read
boot_id when sysctl_bootid is not yet assigned, a race can occur making
boot_id differ between the reads.  Because the whole point of the boot id
is to be unique across a kernel execution, fix this by protecting this
operation with a spinlock.

Given that this operation is not frequently used, hitting the spinlock
on each call should not be an issue.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Cc: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Cc: Matt Mackall &lt;mpm@selenic.com&gt;
Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Greg Kroah-Hartman &lt;greg@kroah.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
