Thread (10 messages) 10 messages, 4 authors, 2022-11-30

Re: [PATCH v10 3/4] random: introduce generic vDSO getrandom() implementation

flat view

From: "Arnd Bergmann" <arnd@arndb.de>
Date: 2022-11-30 15:07:55
Also in: linux-crypto, linux-patches, lkml

Possibly related (same subject, not in this thread)

On Wed, Nov 30, 2022, at 15:59, Jason A. Donenfeld wrote:
On Wed, Nov 30, 2022 at 03:51:01PM +0100, Jason A. Donenfeld wrote:
quoted
On Wed, Nov 30, 2022 at 11:44:30AM +0100, Florian Weimer wrote:
quoted
 * vdso_data will be accessed by 64 bit and compat code at the same time
 * so we should be careful before modifying this structure.

So the ABI must be same for 32-bit and 64-bit mode, and long isn't.
I'll do something like this:


+#ifdef CONFIG_64BIT
+typedef u64 vdso_kernel_ulong;
+#else
+typedef u32 vdso_kernel_ulong;
+#endif
This does not address the ABI concern: to allow 32-bit and 64-bit
tasks to share the same data page, it has to be the same width on
both, either u32 or 64, but not depending on a configuration
option.
struct vdso_rng_data {
vdso_kernel_ulong	generation;
bool			is_ready;
};
There is another problem with this: you have implicit padding
in the structure because the two members have different size
and alignment requirements. The easiest fix is to make them
both u64, or you could have a u32 is_ready and an explit u32
for the padding.

      Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help