[PATCH] random: vDSO: Redefine PAGE_SIZE and PAGE_MASK
Christophe Leroy
christophe.leroy at csgroup.eu
Fri Aug 30 01:00:17 AEST 2024
Hi Vincenzo,
Le 29/08/2024 à 14:01, Vincenzo Frascino a écrit :
> Hi Christophe,
>
> On 27/08/2024 18:14, Christophe Leroy wrote:
>>
>>
>> Le 27/08/2024 à 18:05, Vincenzo Frascino a écrit :
>>> Hi Christophe,
>>>
>>> On 27/08/2024 11:49, Christophe Leroy wrote:
>>>
>>> ...
>
> ...
>
>>>
>>> Could you please clarify where minmax is needed? I tried to build Jason's master
>>> tree for x86, commenting the header and it seems building fine. I might be
>>> missing something.
>>
>> Without it:
>>
>> VDSO32C arch/powerpc/kernel/vdso/vgetrandom-32.o
>> In file included from /home/chleroy/linux-powerpc/lib/vdso/getrandom.c:11,
>> from <command-line>:
> ...
>
>>
>>
>>>
>>>> Same for ARRAY_SIZE(->reserved) by the way, easy to do opencode, we also have it
>>>> only once
>>>>
>>>
>>> I have a similar issue to figure out why linux/array_size.h and
>>> uapi/linux/random.h are needed. It seems that I can build the object without
>>> them. Could you please explain?
>>
>> Without linux/array_size.h:
>>
>> VDSO32C arch/powerpc/kernel/vdso/vgetrandom-32.o
>> In file included from <command-line>:
>> /home/chleroy/linux-powerpc/lib/vdso/getrandom.c: In function
>> '__cvdso_getrandom_data':
>> /home/chleroy/linux-powerpc/lib/vdso/getrandom.c:89:40: error: implicit
> If this is the case, those headers should be defined for the powerpc
> implementation only. The generic implementation should be interpreted as the
> minimum common denominator in between all the architectures for what concerns
> the headers.
>
Sorry, I disagree. You can't rely on necessary headers being included
indirectly by other arch specific headers. getrandom.c uses
ARRAY_SIZE(), it must include the header that defines ARRAY_SIZE().
At the moment, on x86 you get linux/array.h by change through the
following chain, that the reason why the build doesn't break:
In file included from ./include/linux/kernel.h:16,
from ./include/linux/cpumask.h:11,
from ./arch/x86/include/asm/cpumask.h:5,
from ./arch/x86/include/asm/msr.h:11,
from ./arch/x86/include/asm/vdso/gettimeofday.h:19,
from ./include/vdso/datapage.h:164,
from
arch/x86/entry/vdso/../../../../lib/vdso/getrandom.c:9,
From my point of view you can't expect such a chain from each architecture.
Christophe
More information about the Linuxppc-dev
mailing list