[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZtXUM8Isg0012BLs@J2N7QTR9R3>
Date: Mon, 2 Sep 2024 16:05:23 +0100
From: Mark Rutland <mark.rutland@....com>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: Adhemerval Zanella <adhemerval.zanella@...aro.org>,
Theodore Ts'o <tytso@....edu>, linux-kernel@...r.kernel.org,
linux-crypto@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-arch@...r.kernel.org,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
Eric Biggers <ebiggers@...nel.org>,
Christophe Leroy <christophe.leroy@...roup.eu>
Subject: Re: [PATCH v3] aarch64: vdso: Wire up getrandom() vDSO implementation
On Mon, Sep 02, 2024 at 04:41:28PM +0200, Jason A. Donenfeld wrote:
> On Mon, Sep 02, 2024 at 03:31:43PM +0100, Mark Rutland wrote:
> > ssize_t __kernel_getrandom(void *buffer, size_t len, unsigned int flags,
> > void *opaque_state, size_t opaque_len)
> > {
> > if (alternative_has_cap_likely(ARM64_HAS_FPSIMD)) {
> > return __cvdso_getrandom(buffer, len, flags,
> > opaque_state, opaque_len);
> > }
> >
> > if (unlikely(opaque_len == ~0UL && !buffer && !len && !flags))
> > return -ENOSYS;
> >
> > return getrandom_syscall(buffer, len, flags);
> > }
> >
> > ... though the conditions for returning -ENOSYS look very odd to me; why
> > do we care about fast-pathing that specific case rather than forwarding
> > that to the kernel, and does __cvdso_getrandom() handle that correctly?
>
> Adhemerval's code here is fine and correct. The opaque_len==~0UL thing
> is a special vDSO case for getting the param struct back, not something
> related to the kernel. See __cvdso_getrandom_data() for details.
Ok, so this is to say "we cannot provide a vgetrandom_opaque_params".
Is the syscall fallback just for the CRIU case mentioned in
__cvdso_getrandom_data()? The comment above __cvdso_getrandom_data()
says:
If @buffer, @len, and @flags are 0, and @opaque_len is ~0UL, then
@opaque_state is populated with a struct vgetrandom_opaque_params and the
function returns 0; if it does not return 0, this function should not be
used.
... so presumably the caller shouldn't bother to call again if it got
-ENOSYS above.
Mark.
Powered by blists - more mailing lists