2022-11-28 17:33:39

by Jason A. Donenfeld

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

Hi Arnd,

On Mon, Nov 28, 2022 at 02:54:39PM +0100, Arnd Bergmann wrote:
> On Sun, Nov 27, 2022, at 21:18, Jason A. Donenfeld wrote:
> >>
> >> 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
> > for v8. At the very least it should get rid of the more awkward
> > `select ADVISE_SYSCALLS if X86_64` part, and will better separate the
> > arch code from non-arch code.
>
> I think you should not need an __ARCH_WANT_SYS_* symbol for this,
> the only place we actually need them for is the asm-generic/unistd.h
> header which is still used on a couple of architectures (I have
> an experimental series for replacing it with a generic syscall.tbl
> file, but it's not ready for 6.2). In most cases, the __ARCH_WANT_SYS_*
> symbols are only used for syscalls that are part of the table for
> old architectures but get skipped on newer targets that always had
> a replacement syscalls (e.g. getrlimit getting replaced by prlimit64)
>
> I think we should just reserve the syscall number for all architectures
> right away and #define the __NR_* macro. libc will generally need
> a runtime check anyway, and defining it now avoids the problem of
> the tables getting out of sync.
>
> The Kconfig symbol is fine in this case.

Oh, great, okay. I'll get rid of the __ARCH stuff entirely then. I
jumped the gun and posted v8 earlier today, but I'll include this in a
v9, whenever it makes sense to send that. So when reading v8, just
assume all he __ARCH_WANT_SYS_* business has been removed.

Jason