Re: [PATCH] random: discourage use of archrandom outside of rng

From: Heiko Carstens
Date: Mon Jul 25 2022 - 07:33:47 EST


On Mon, Jul 25, 2022 at 01:10:38PM +0200, Jason A. Donenfeld wrote:
> Borislav pointed out during the review of "random: handle archrandom
> with multiple longs" that people might actually use this function, which
> might not be good because the function has surprising semantics. This of
> course was also the case before that patch, and indeed RDSEED-like
> functions across architectures often behave surprisingly, failing often.
> While random.c has been written specifically to work with that behavior,
> not much else is well equipped for that.
>
> So add a comment suggesting that this is not for general consumption.
> Fortunately, nobody uses this for general consumption anyway, and people
> who try quickly find themselves in trouble. But adding this comment out
> of an abundance of caution was nonetheless suggested, and it at least
> means there will be easier justification for cleaning up potential
> misuses of the function later.
>
> Cc: Borislav Petkov <bp@xxxxxxx>
> Cc: Heiko Carstens <hca@xxxxxxxxxxxxx>
> Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
> Cc: Mark Rutland <mark.rutland@xxxxxxx>
> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
> Cc: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
> Suggested-by: Borislav Petkov <bp@xxxxxxx>
> Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
> ---
> arch/arm64/include/asm/archrandom.h | 13 +++++++++++++
> arch/powerpc/include/asm/archrandom.h | 8 ++++++++
> arch/s390/include/asm/archrandom.h | 8 ++++++++
> arch/um/include/asm/archrandom.h | 8 ++++++++
> arch/x86/include/asm/archrandom.h | 9 ++++++---
> include/asm-generic/archrandom.h | 8 ++++++++
> 6 files changed, 51 insertions(+), 3 deletions(-)

For s390:
Acked-by: Heiko Carstens <hca@xxxxxxxxxxxxx>