Re: [PATCH v2 14/17] selftests: vdso: Make test_vdso_getrandom look for the right vDSO function

LEROY Christophe
2024-08-26T07:35:42Z

Le 26/08/2024 à 09:28, Jason A. Donenfeld a écrit :
> On Thu, Aug 22, 2024 at 09:13:22AM +0200, Christophe Leroy wrote:
>> Don't hard-code x86 specific names, use vdso_config definitions
>> to find the correct function matching the architecture.
>>
>> Add random VDSO function names in names[][]. Remove the #ifdef
>> CONFIG_VDSO32, having the name there all the time is harmless
>> and guaranties a steady index for following strings.
>
> This is indeed the right way of doing it. Thanks. I'll take this now,
> though with one small fixup:
>
>> + const char *version = versions[VDSO_VERSION];
>> + const char **name = (const char **)&names[VDSO_NAMES];
>
> I'll just do:
>
> const char *name = names[VDSO_NAMES][6];
>
> Instead of referring to name[6] everywhere after. Seems more straight
> forward.

Yes you are right that's more straight forward when using only one of
the names.
I copy-pasted it from the gettimeofday test which uses several names
from the table.

Christophe