<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/char/random.c, branch v3.16</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.16</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.16'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2014-07-19T05:42:13Z</updated>
<entry>
<title>random: check for increase of entropy_count because of signed conversion</title>
<updated>2014-07-19T05:42:13Z</updated>
<author>
<name>Hannes Frederic Sowa</name>
<email>hannes@stressinduktion.org</email>
</author>
<published>2014-07-18T21:26:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=79a8468747c5f95ed3d5ce8376a3e82e0c5857fc'/>
<id>urn:sha1:79a8468747c5f95ed3d5ce8376a3e82e0c5857fc</id>
<content type='text'>
The expression entropy_count -= ibytes &lt;&lt; (ENTROPY_SHIFT + 3) could
actually increase entropy_count if during assignment of the unsigned
expression on the RHS (mind the -=) we reduce the value modulo
2^width(int) and assign it to entropy_count. Trinity found this.

[ Commit modified by tytso to add an additional safety check for a
  negative entropy_count -- which should never happen, and to also add
  an additional paranoia check to prevent overly large count values to
  be passed into urandom_read().  ]

Reported-by: Dave Jones &lt;davej@redhat.com&gt;
Signed-off-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>Merge tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random</title>
<updated>2014-06-18T00:23:14Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2014-06-18T00:23:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5ee22beeb25a5fa7fc6daf3597a8d9265f8c9ce1'/>
<id>urn:sha1:5ee22beeb25a5fa7fc6daf3597a8d9265f8c9ce1</id>
<content type='text'>
Pull randomness bugfix from Ted Ts'o:
 "random: fix entropy accounting bug introduced in v3.15"

* tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
  random: fix nasty entropy accounting bug
</content>
</entry>
<entry>
<title>random: fix nasty entropy accounting bug</title>
<updated>2014-06-16T01:04:32Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2014-06-16T01:04:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e33ba5fa7afce1a9f159704121d4e4d110df8185'/>
<id>urn:sha1:e33ba5fa7afce1a9f159704121d4e4d110df8185</id>
<content type='text'>
Commit 0fb7a01af5b0 "random: simplify accounting code", introduced in
v3.15, has a very nasty accounting problem when the entropy pool has
has fewer bytes of entropy than the number of requested reserved
bytes.  In that case, "have_bytes - reserved" goes negative, and since
size_t is unsigned, the expression:

       ibytes = min_t(size_t, ibytes, have_bytes - reserved);

... does not do the right thing.  This is rather bad, because it
defeats the catastrophic reseeding feature in the
xfer_secondary_pool() path.

It also can cause the "BUG: spinlock trylock failure on UP" for some
kernel configurations when prandom_reseed() calls get_random_bytes()
in the early init, since when the entropy count gets corrupted,
credit_entropy_bits() erroneously believes that the nonblocking pool
has been fully initialized (when in fact it is not), and so it calls
prandom_reseed(true) recursively leading to the spinlock BUG.

The logic is *not* the same it was originally, but in the cases where
it matters, the behavior is the same, and the resulting code is
hopefully easier to read and understand.

Fixes: 0fb7a01af5b0 "random: simplify accounting code"
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Cc: Greg Price &lt;price@mit.edu&gt;
Cc: stable@vger.kernel.org  #v3.15
</content>
</entry>
<entry>
<title>random: convert use of typedef ctl_table to struct ctl_table</title>
<updated>2014-06-06T23:08:15Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2014-06-06T21:37:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5eb10d912ea0add5c15b0df1920ddd1681f0c9fb'/>
<id>urn:sha1:5eb10d912ea0add5c15b0df1920ddd1681f0c9fb</id>
<content type='text'>
This typedef is unnecessary and should just be removed.

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-3.16/core' of git://git.kernel.dk/linux-block into next</title>
<updated>2014-06-02T16:29:34Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2014-06-02T16:29:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=681a2895486243a82547d8c9f53043eb54b53da0'/>
<id>urn:sha1:681a2895486243a82547d8c9f53043eb54b53da0</id>
<content type='text'>
Pull block core updates from Jens Axboe:
 "It's a big(ish) round this time, lots of development effort has gone
  into blk-mq in the last 3 months.  Generally we're heading to where
  3.16 will be a feature complete and performant blk-mq.  scsi-mq is
  progressing nicely and will hopefully be in 3.17.  A nvme port is in
  progress, and the Micron pci-e flash driver, mtip32xx, is converted
  and will be sent in with the driver pull request for 3.16.

  This pull request contains:

   - Lots of prep and support patches for scsi-mq have been integrated.
     All from Christoph.

   - API and code cleanups for blk-mq from Christoph.

   - Lots of good corner case and error handling cleanup fixes for
     blk-mq from Ming Lei.

   - A flew of blk-mq updates from me:

     * Provide strict mappings so that the driver can rely on the CPU
       to queue mapping.  This enables optimizations in the driver.

     * Provided a bitmap tagging instead of percpu_ida, which never
       really worked well for blk-mq.  percpu_ida relies on the fact
       that we have a lot more tags available than we really need, it
       fails miserably for cases where we exhaust (or are close to
       exhausting) the tag space.

     * Provide sane support for shared tag maps, as utilized by scsi-mq

     * Various fixes for IO timeouts.

     * API cleanups, and lots of perf tweaks and optimizations.

   - Remove 'buffer' from struct request.  This is ancient code, from
     when requests were always virtually mapped.  Kill it, to reclaim
     some space in struct request.  From me.

   - Remove 'magic' from blk_plug.  Since we store these on the stack
     and since we've never caught any actual bugs with this, lets just
     get rid of it.  From me.

   - Only call part_in_flight() once for IO completion, as includes two
     atomic reads.  Hopefully we'll get a better implementation soon, as
     the part IO stats are now one of the more expensive parts of doing
     IO on blk-mq.  From me.

   - File migration of block code from {mm,fs}/ to block/.  This
     includes bio.c, bio-integrity.c, bounce.c, and ioprio.c.  From me,
     from a discussion on lkml.

  That should describe the meat of the pull request.  Also has various
  little fixes and cleanups from Dave Jones, Shaohua Li, Duan Jiong,
  Fengguang Wu, Fabian Frederick, Randy Dunlap, Robert Elliott, and Sam
  Bradshaw"

* 'for-3.16/core' of git://git.kernel.dk/linux-block: (100 commits)
  blk-mq: push IPI or local end_io decision to __blk_mq_complete_request()
  blk-mq: remember to start timeout handler for direct queue
  block: ensure that the timer is always added
  blk-mq: blk_mq_unregister_hctx() can be static
  blk-mq: make the sysfs mq/ layout reflect current mappings
  blk-mq: blk_mq_tag_to_rq should handle flush request
  block: remove dead code in scsi_ioctl:blk_verify_command
  blk-mq: request initialization optimizations
  block: add queue flag for disabling SG merging
  block: remove 'magic' from struct blk_plug
  blk-mq: remove alloc_hctx and free_hctx methods
  blk-mq: add file comments and update copyright notices
  blk-mq: remove blk_mq_alloc_request_pinned
  blk-mq: do not use blk_mq_alloc_request_pinned in blk_mq_map_request
  blk-mq: remove blk_mq_wait_for_tags
  blk-mq: initialize request in __blk_mq_alloc_request
  blk-mq: merge blk_mq_alloc_reserved_request into blk_mq_alloc_request
  blk-mq: add helper to insert requests from irq context
  blk-mq: remove stale comment for blk_mq_complete_request()
  blk-mq: allow non-softirq completions
  ...
</content>
</entry>
<entry>
<title>random: fix BUG_ON caused by accounting simplification</title>
<updated>2014-05-17T02:18:22Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2014-05-17T01:40:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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: export add_disk_randomness</title>
<updated>2014-04-28T15:29:55Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@infradead.org</email>
</author>
<published>2014-04-25T07:36:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bdcfa3e57c9d92b082d2378bc9a64a3a8750fa8d'/>
<id>urn:sha1:bdcfa3e57c9d92b082d2378bc9a64a3a8750fa8d</id>
<content type='text'>
This will be needed for pending changes to the scsi midlayer that now
calls lower level block APIs, as well as any blk-mq driver that wants to
contribute to the random pool.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Acked-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
</content>
</entry>
<entry>
<title>random: Add arch_has_random[_seed]()</title>
<updated>2014-03-20T02:24:08Z</updated>
<author>
<name>H. Peter Anvin</name>
<email>hpa@linux.intel.com</email>
</author>
<published>2014-03-17T23:36:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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:06Z</updated>
<author>
<name>H. Peter Anvin</name>
<email>hpa@linux.intel.com</email>
</author>
<published>2014-03-17T23:36:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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:06Z</updated>
<author>
<name>H. Peter Anvin</name>
<email>hpa@linux.intel.com</email>
</author>
<published>2014-03-17T23:36:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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>
</feed>
