public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stephan Müller" <smueller@chronox.de>
To: Octavian Purdila <octavian.purdila@nxp.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: jitterentropy init test failure on ARMv7 with gcc 6.2
Date: Thu, 11 May 2017 03:53:55 +0200	[thread overview]
Message-ID: <2351816.IB1mYTDMmF@positron.chronox.de> (raw)
In-Reply-To: <1494430839.8189.22.camel@nxp.com>

Am Mittwoch, 10. Mai 2017, 17:40:40 CEST schrieb Octavian Purdila:

Hi Octavian,

> Hi Stephan,
> 
> Recently I started seeing the following on some of our ARMv7 boards
> (IMX7D):
> 
> jitterentropy: Initialization failed with host not compliant with
> requirements: 2
> 
> and I traced this to the followin init test:
> 
> 	lowdelta = time2 - time;
> 	if (!(lowdelta % 100))
> 		count_mod++;
> 	...
>         /*
>          * Ensure that we have variations in the time stamp below 10
> 	 * for at least 10% of all checks -- on some platforms, the
> 	 * counter increments in multiples of 100, but not always.
>          */
> 	if ((TESTLOOPCOUNT/10 * 9) < count_mod)
> 		return JENT_ECOARSETIME;
> 
> Digging deeper, I've noticed that the delta between the timestamp is
> almost always constant. With the gcc 4.9 it is 102 but with gcc 6.2 it
> is 100 and this is the reason the above test fails.
> 
> Running a tight loop and measuring the delta in between shows that the
> timestamp counter increments with a fairly low value of 7 (it looks
> like random_get_entropy() is used and that it is defined to
> get_cycles()). 
> 
> So the reason is not that the counter increments in multiples of 100,
> but that the time to run jent_fold_time() is constant during the
> initialization tests. Further analyzing it, it looks like
> jent_fold_time() is called with a constant loop count of 1 which would
> explain why the delta is constant.
> 
> At this point, I am not sure that the test above is correct. Am I
> missing something?

Based on your description, the above test is very much correct. The inital 
self test code determined that the timer is too coarse to be used for the RNG. 
Thus, the RNG will not produce enough or any entropy on this hardware. This 
ultimately means that the RNG shall not be used. With the indicated error, the 
RNG is not allocated and thus not usable on your system.

Ciao
Stephan

      reply	other threads:[~2017-05-11  1:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 15:40 jitterentropy init test failure on ARMv7 with gcc 6.2 Octavian Purdila
2017-05-11  1:53 ` Stephan Müller [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=2351816.IB1mYTDMmF@positron.chronox.de \
    --to=smueller@chronox.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=octavian.purdila@nxp.com \
    /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