[PATCH v2 06/17] vdso: Change getrandom's generation to unsigned long

From: Christophe Leroy
Date: Thu Aug 22 2024 - 03:15:40 EST


Performing SMP atomic operations on u64 fails on powerpc32.

Random driver generation is handled as unsigned long not u64,
see for instance base_cnrg or struct crng.

Use the same type for vDSO's getrandom as it gets copied
from the above. This is also in line with the local
current_generation which is already an unsigned long.

Signed-off-by: Christophe Leroy <christophe.leroy@xxxxxxxxxx>
---
include/vdso/datapage.h | 2 +-
include/vdso/getrandom.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h
index b85f24cac3f5..00b66a9b5778 100644
--- a/include/vdso/datapage.h
+++ b/include/vdso/datapage.h
@@ -123,7 +123,7 @@ struct vdso_data {
* @is_ready: boolean signaling whether the RNG is initialized
*/
struct vdso_rng_data {
- u64 generation;
+ unsigned long generation;
u8 is_ready;
};

diff --git a/include/vdso/getrandom.h b/include/vdso/getrandom.h
index a8b7c14b0ae0..36fd166bf330 100644
--- a/include/vdso/getrandom.h
+++ b/include/vdso/getrandom.h
@@ -38,7 +38,7 @@ struct vgetrandom_state {
};
u8 batch_key[CHACHA_BLOCK_SIZE * 2];
};
- u64 generation;
+ unsigned long generation;
u8 pos;
bool in_use;
};
--
2.44.0