From: George Spelvin <lkml@SDF.ORG>
To: linux-kernel@vger.kernel.org, tytso@mit.edu
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>, lkml@sdf.org
Subject: Re: [RFC PATCH v1 36/50] random: Merge batched entropy buffers
Date: Wed, 1 Apr 2020 21:11:04 +0000 [thread overview]
Message-ID: <20200401211104.GA2013@SDF.ORG> (raw)
In-Reply-To: <202003281643.02SGhLiv003379@sdf.org>
I just noticed a rather insidious bug in the preceding, so please
revoke my S-o-b.
Storing the batch position in the first byte works fine if it's
updated very late in get_random_uXX(), after the random value is
read from a refilled batch. The first few versions of my code
did this.
But then I discovered the "xor trick" to handle unaligned reads
and it hugely simplfiied the code. It simplified it so much that
the unaligned position wasn't needed much; only to compute the
aligned position.
While squashing together the various revisions to this code, I
moved the write-back of the position earlier in the code.. Which
violates the requirement stated in paragraph 2. :-(
There are several possible fixes, but the simplest is to move
the "u8 position;" down a couple of lines, out of the union.
Since the following patch reduces the lock to a single byte,
there's room in the structure without increasing its size.
Revised patch will follow.
prev parent reply other threads:[~2020-04-01 21:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 2:03 [RFC PATCH v1 36/50] random: Merge batched entropy buffers George Spelvin
2020-04-01 21:11 ` George Spelvin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200401211104.GA2013@SDF.ORG \
--to=lkml@sdf.org \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.