[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201116132007.GA30323@willie-the-truck>
Date: Mon, 16 Nov 2020 13:20:07 +0000
From: Will Deacon <will@...nel.org>
To: Andre Przywara <andre.przywara@....com>
Cc: Theodore Ts'o <tytso@....edu>, Mark Rutland <mark.rutland@....com>,
Catalin Marinas <catalin.marinas@....com>,
Mark Brown <broonie@...nel.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] random: Use arch_get_random_long_early() for
init_std_data()
On Fri, Nov 13, 2020 at 04:19:12PM +0000, Andre Przywara wrote:
> In commit 253d3194c2b5 ("random: add arch_get_random_*long_early()") we
> introduced _early versions of arch_get_random_long(), that are used on
> arm64 to use the CPU RNDR instruction early in the boot process, before
> we have established system-wide availability.
> This covers the calls in crng_initialize_primary(), but missed the calls
> in init_std_data(), happening just before that.
>
> Use the _early versions of the arch_get_random* calls also in
> init_std_data(), to help initialising the pool with proper seed values.
>
> Fixes: 253d3194c2b5 ("random: add arch_get_random_*long_early()")
> Cc: Mark Rutland <mark.rutland@....com>
> Signed-off-by: Andre Przywara <andre.przywara@....com>
> ---
> drivers/char/random.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index 2a41b21623ae..43bb331a67bd 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -1778,8 +1778,8 @@ static void __init init_std_data(struct entropy_store *r)
>
> mix_pool_bytes(r, &now, sizeof(now));
> for (i = r->poolinfo->poolbytes; i > 0; i -= sizeof(rv)) {
> - if (!arch_get_random_seed_long(&rv) &&
> - !arch_get_random_long(&rv))
> + if (!arch_get_random_seed_long_early(&rv) &&
> + !arch_get_random_long_early(&rv))
> rv = random_get_entropy();
> mix_pool_bytes(r, &rv, sizeof(rv));
Acked-by: Will Deacon <will@...nel.org>
Will
Powered by blists - more mailing lists