lkml.org 
[lkml]   [2022]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v10 3/4] random: introduce generic vDSO getrandom() implementation
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:
>> On Wed, Nov 30, 2022 at 11:44:30AM +0100, Florian Weimer wrote:
>> >
>> > * 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

\
 
 \ /
  Last update: 2022-11-30 16:08    [W:0.049 / U:24.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site