Re: [PATCH v7 1/3] random: add vgetrandom_alloc() syscall

From: Thomas Gleixner
Date: Mon Nov 28 2022 - 04:12:25 EST


On Sun, Nov 27 2022 at 21:18, Jason A. Donenfeld wrote:
> On Fri, Nov 25, 2022 at 09:45:31PM +0100, Thomas Gleixner wrote:
>> > --- a/arch/x86/include/asm/unistd.h
>> > +++ b/arch/x86/include/asm/unistd.h
>> > @@ -27,6 +27,7 @@
>> > # define __ARCH_WANT_COMPAT_SYS_PWRITEV64
>> > # define __ARCH_WANT_COMPAT_SYS_PREADV64V2
>> > # define __ARCH_WANT_COMPAT_SYS_PWRITEV64V2
>> > +# define __ARCH_WANT_VGETRANDOM_ALLOC
>>
>> So instead of this define, why can't you do:
>>
>> config VGETRADOM_ALLOC
>> bool
>> select ADVISE_SYSCALLS
>>
>> and then have
>>
>> config GENERIC_VDSO_RANDOM_WHATEVER
>> bool
>> select VGETRANDOM_ALLOC
>>
>> This gives a clear Kconfig dependency instead of the random
>> ADVISE_SYSCALLS select.
>
> That's much better indeed. I was trying to straddle the two conventions
> of `#define __ARCH_...` for syscalls and a Kconfig for vDSO functions,
> but doing it all together as you've suggested is nicer.
>
> I'll try to figure this out, though so far futzing around suggests there
> might have to be both, because of unistd.h being a userspace header.
> That is, include/uapi/asm-generic/unistd.h typically needs a `#if
> __ARCH_WANT..., #define ...` in it. I'll give it a spin and you'll see

Bah. Did not think about that user space part...

Thanks,

tglx