mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-25 00:52:45 -04:00
vdso: Add generic random data storage
Extend the generic vDSO data storage with a page for the random state data. The random state data is stored in a dedicated page, as the existing storage page is only meant for time-related, time-namespace-aware data. This simplifies to access logic to not need to handle time namespaces anymore and also frees up more space in the time-related page. In case further generic vDSO data store is required it can be added to the random state page. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20250204-vdso-store-rng-v3-6-13a4669dfc8c@linutronix.de
This commit is contained in:
committed by
Thomas Gleixner
parent
df7fcbefa7
commit
51d6ca373f
@@ -12,6 +12,9 @@
|
||||
#include <uapi/linux/mman.h>
|
||||
#include <uapi/linux/random.h>
|
||||
|
||||
/* Bring in default accessors */
|
||||
#include <vdso/vsyscall.h>
|
||||
|
||||
#undef PAGE_SIZE
|
||||
#undef PAGE_MASK
|
||||
#define PAGE_SIZE (1UL << CONFIG_PAGE_SHIFT)
|
||||
@@ -152,7 +155,7 @@ retry_generation:
|
||||
|
||||
/*
|
||||
* Prevent the syscall from being reordered wrt current_generation. Pairs with the
|
||||
* smp_store_release(&_vdso_rng_data.generation) in random.c.
|
||||
* smp_store_release(&vdso_k_rng_data->generation) in random.c.
|
||||
*/
|
||||
smp_rmb();
|
||||
|
||||
@@ -256,5 +259,6 @@ fallback_syscall:
|
||||
static __always_inline ssize_t
|
||||
__cvdso_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, size_t opaque_len)
|
||||
{
|
||||
return __cvdso_getrandom_data(__arch_get_vdso_rng_data(), buffer, len, flags, opaque_state, opaque_len);
|
||||
return __cvdso_getrandom_data(__arch_get_vdso_u_rng_data(), buffer, len, flags,
|
||||
opaque_state, opaque_len);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user