Re: [PATCH stable 4.14] s390/archrandom: simplify back to earlier design and initialize earlier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 04, 2022 at 12:28:19PM +0200, Jason A. Donenfeld wrote:
> commit e4f74400308cb8abde5fdc9cad609c2aba32110c upstream.
> 
> s390x appears to present two RNG interfaces:
> - a "TRNG" that gathers entropy using some hardware function; and
> - a "DRBG" that takes in a seed and expands it.
> 
> Previously, the TRNG was wired up to arch_get_random_{long,int}(), but
> it was observed that this was being called really frequently, resulting
> in high overhead. So it was changed to be wired up to arch_get_random_
> seed_{long,int}(), which was a reasonable decision. Later on, the DRBG
> was then wired up to arch_get_random_{long,int}(), with a complicated
> buffer filling thread, to control overhead and rate.
> 
> Fortunately, none of the performance issues matter much now. The RNG
> always attempts to use arch_get_random_seed_{long,int}() first, which
> means a complicated implementation of arch_get_random_{long,int}() isn't
> really valuable or useful to have around. And it's only used when
> reseeding, which means it won't hit the high throughput complications
> that were faced before.
> 
> So this commit returns to an earlier design of just calling the TRNG in
> arch_get_random_seed_{long,int}(), and returning false in arch_get_
> random_{long,int}().
> 
> Part of what makes the simplification possible is that the RNG now seeds
> itself using the TRNG at bootup. But this only works if the TRNG is
> detected early in boot, before random_init() is called. So this commit
> also causes that check to happen in setup_arch().
> 
> Cc: stable@xxxxxxxxxxxxxxx
> Cc: Harald Freudenberger <freude@xxxxxxxxxxxxx>
> Cc: Ingo Franzki <ifranzki@xxxxxxxxxxxxx>
> Cc: Juergen Christ <jchrist@xxxxxxxxxxxxx>
> Cc: Heiko Carstens <hca@xxxxxxxxxxxxx>
> Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
> Link: https://lore.kernel.org/r/20220610222023.378448-1-Jason@xxxxxxxxx
> Reviewed-by: Harald Freudenberger <freude@xxxxxxxxxxxxx>
> Acked-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
> Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>
> Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>

All now queued up, thanks.

greg k-h



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux