From: "Theodore Ts'o" <tytso@mit.edu>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: /dev/random changes for 3.13
Date: Fri, 15 Nov 2013 19:33:24 -0500 [thread overview]
Message-ID: <20131116003324.GC16722@thunk.org> (raw)
In-Reply-To: <CA+55aFyyENCDErpcYGcy4qf2M8mBtRo_9_nT0HaUPuY+kozk7g@mail.gmail.com>
On Fri, Nov 15, 2013 at 01:58:05PM -0800, Linus Torvalds wrote:
> Ok, I finally got around to the random tree, but your proposed merge
> resolution makes no sense, so I didn't end up applying it.
>
> > - - r->entropy_total += nbits;
> > if (!r->initialized && nbits > 0) {
> > + r->entropy_total += nbits;
>
> This part undoes your commit 6265e169cd31 ("random: push extra entropy
> to the output pools"), and the "entropy_total" field will now never be
> non-zero when "r->initialized" is set....
You're right, I totally screwed that up. Part of the problem is that
I should have cleaned up the if statement in commit 6265e169cd31 so
that it looked like this:
r->entropy_total += nbits;
if (!r->initialized && (r->entropy_total > 128)) {
r->initialized = 1;
r->entropy_total = 0;
}
}
... and so at the top of the dev branch, it should have looked like
this:
r->entropy_total += nbits;
if (!r->initialized && (r->entropy_total > 128)) {
if (r == &nonblocking_pool)
pr_notice("random: %s pool is initialized\n", r->name);
r->initialized = 1;
r->entropy_total = 0;
}
Instead, I had a more complicated structure which confused me when I
cleaned up the merge.
So I'm going to propose the following merge resolution:
diff --cc drivers/char/random.c
index cdf4cfb,4fe5609..0000000
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@@ -654,14 -601,12 +654,13 @@@ retry
if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig)
goto retry;
- if (!r->initialized && nbits > 0) {
- r->entropy_total += nbits;
- if (r->entropy_total > 128) {
- r->initialized = 1;
- if (r == &nonblocking_pool)
- prandom_reseed_late();
+ r->entropy_total += nbits;
- if (!r->initialized && nbits > 0) {
- if (r->entropy_total > 128) {
- if (r == &nonblocking_pool)
- pr_notice("random: %s pool is initialized\n",
- r->name);
- r->initialized = 1;
- r->entropy_total = 0;
++ if (!r->initialized && (r->entropy_total > 128)) {
++ r->initialized = 1;
++ r->entropy_total = 0;
++ if (r == &nonblocking_pool) {
++ prandom_reseed_late();
++ pr_notice("random: %s pool is initialized\n", r->name);
}
}
It does fold a cleanup in with the merge resolution, but it's not
actually changing anything in terms of code behavior, and it makes the
resulting merge much more obvious.
Are you OK with that?
- Ted
prev parent reply other threads:[~2013-11-16 0:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-14 2:03 /dev/random changes for 3.13 Theodore Ts'o
2013-11-14 6:52 ` Theodore Ts'o
2013-11-15 21:58 ` Linus Torvalds
2013-11-16 0:33 ` Theodore Ts'o [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=20131116003324.GC16722@thunk.org \
--to=tytso@mit.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox