[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871qu0qri6.fsf@oldenburg.str.redhat.com>
Date: Mon, 01 Aug 2022 10:48:01 +0200
From: Florian Weimer <fweimer@...hat.com>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: linux-kernel@...r.kernel.org, linux-crypto@...r.kernel.org,
x86@...nel.org, Nadia Heninger <nadiah@...ucsd.edu>,
Thomas Ristenpart <ristenpart@...nell.edu>,
Theodore Ts'o <tytso@....edu>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Adhemerval Zanella Netto <adhemerval.zanella@...aro.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH RFC v2] random: implement getrandom() in vDSO
* Jason A. Donenfeld:
> API-wise, vDSO getrandom has a pair of functions:
>
> ssize_t getrandom(void *state, void *buffer, size_t len, unsigned int flags);
> void *getrandom_alloc([inout] size_t *num, [out] size_t *size_per_each);
>
> In the first function, the return value and the latter 3 arguments are
> the same as ordinary getrandom(), while the first argument is a pointer
> to some state allocated with getrandom_alloc(). getrandom_alloc() takes
> the desired number of states, and returns an array of states, the number
> actually allocated, and the size in bytes of each one, enabling a libc
> to use one per thread. We very intentionally do *not* leave state
> allocation up to the caller. There are too many weird things that can go
> wrong, and it's important that vDSO does not provide too generic of a
> mechanism. It's not going to store its state in just any old memory
> address. It'll do it only in ones it allocates.
I still don't see why this couldn't be per-thread state (if you handle
fork generations somehow).
I also think it makes sense to introduce batching for the system call
implementation first, and tie that to the vDSO acceleration. I expect a
large part of the benefit comes from the batching, not the system call
avoidance.
Thanks,
Florian
Powered by blists - more mailing lists