From: Stephan Mueller <smueller@chronox.de>
To: "Jörn Engel" <joern@logfs.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>, "H. Peter Anvin" <hpa@zytor.com>,
Linux Kernel Developers List <linux-kernel@vger.kernel.org>,
macro@linux-mips.org, ralf@linux-mips.org, dave.taht@gmail.com,
blogic@openwrt.org, andrewmcgr@gmail.com, geert@linux-m68k.org,
tg@mirbsd.de
Subject: Re: [PATCH,RFC] random: collect cpu randomness
Date: Sun, 02 Feb 2014 22:25:31 +0100 [thread overview]
Message-ID: <16782692.5vMS7Bhbvf@myon.chronox.de> (raw)
In-Reply-To: <20140202203617.GA9499@logfs.org>
Am Sonntag, 2. Februar 2014, 15:36:17 schrieb Jörn Engel:
Hi Jörn,
> Collects entropy from random behaviour all modern cpus exhibit. The
> scheduler and slab allocator are instrumented for this purpose. How
> much randomness can be gathered is clearly hardware-dependent and hard
> to estimate. Therefore the entropy estimate is zero, but random bits
> still get mixed into the pools.
May I ask what the purpose of the patches is when no entropy is implied? I see
that the pool is stirred more. But is that really a problem that needs
addressing?
Please, do not get me wrong with the presented critisism here -- the approach
in general looks interesting.
However, the following patches makes me wonder big time.
> extern void get_random_bytes(void *buf, int nbytes);
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index a88f4a485c5e..7af6389f9b9e 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2511,6 +2511,7 @@ need_resched:
> rq = cpu_rq(cpu);
> rcu_note_context_switch(cpu);
> prev = rq->curr;
> + __add_cpu_randomness(__builtin_return_address(1), prev);
>
> schedule_debug(prev);
>
> diff --git a/mm/slab.c b/mm/slab.c
> index eb043bf05f4c..ea5a30d44ad1 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -3587,6 +3587,7 @@ static __always_inline void *__do_kmalloc(size_t size,
> gfp_t flags, trace_kmalloc(caller, ret,
> size, cachep->size, flags);
>
> + add_cpu_randomness(__builtin_return_address(2), ret);
> return ret;
> }
First, the noise source you add is constantly triggered throughout the
execution of the kernel. Entropy is very important, we (who are interested in
crypto) know that. But how often is entropy needed? Other folks wonder about
the speed of the kernel. And with these two patches, every kmalloc and every
scheduling invocation now dives into the random.c code to do something. I
would think this is a bit expensive, especially to stir the pool without
increasing the entropy estimator. I think entropy collection should be
performed when it is needed and not throughout the lifetime of the system.
Second, when I offered my initial patch which independently collects some
entropy on the CPU execution timing, I got shot down with one concern raised
by Ted, and that was about whether a user can influence the entropy collection
process. When I am trying to measure CPU execution timing in the RNG, the
concern was raised that the measured timing variations was due to CPU states
that were influenced by users. Your patch here clearly hooks into code paths
which are definitely affected by user actions. So, this patch therefore would
be subject to the same concerns. I personally think that this is not so much
an issue, yet it was raised previously.
It seems I have a bad timing, because just two days ago I released a new
attempt on the CPU jitter RNG [1] with a new noise source, and I was just
about to prepare a release email. With that attempt, both issues raised above
are addressed, including a theoretical foundation of the noise source.
[1] http://www.chronox.de/
Ciao
Stephan
--
| Cui bono? |
next prev parent reply other threads:[~2014-02-02 21:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-02 20:36 Jörn Engel
2014-02-02 21:25 ` Stephan Mueller [this message]
2014-02-03 1:24 ` Jörn Engel
2014-02-03 1:28 ` H. Peter Anvin
2014-02-03 13:36 ` Stephan Mueller
2014-02-03 1:39 ` Theodore Ts'o
2014-02-03 3:35 ` Jörn Engel
2014-02-03 12:54 ` Thorsten Glaser
2014-02-03 13:06 ` Stephan Mueller
2014-02-03 15:50 ` Jörn Engel
2014-02-03 16:37 ` Theodore Ts'o
2014-02-03 18:48 ` Jörn Engel
2014-03-23 18:00 ` [PATCH] random: mix all saved registers into entropy pool Jörn Engel
2014-02-03 21:54 ` [PATCH,RFC] random: collect cpu randomness Maciej W. Rozycki
2014-02-03 22:44 ` Theodore Ts'o
2014-02-06 22:20 ` Kees Cook
2014-02-06 22:21 ` Dave Taht
2014-02-07 7:44 ` Jörn Engel
2014-02-20 9:50 ` Paolo Bonzini
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=16782692.5vMS7Bhbvf@myon.chronox.de \
--to=smueller@chronox.de \
--cc=andrewmcgr@gmail.com \
--cc=blogic@openwrt.org \
--cc=dave.taht@gmail.com \
--cc=geert@linux-m68k.org \
--cc=hpa@zytor.com \
--cc=joern@logfs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=macro@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=tg@mirbsd.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®