From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
Theodore Ts'o <tytso@mit.edu>,
linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Eric Biggers <ebiggers@kernel.org>
Subject: Re: [PATCH] aarch64: vdso: Wire up getrandom() vDSO implementation
Date: Tue, 27 Aug 2024 10:53:44 +0200 [thread overview]
Message-ID: <Zs2UGH6xjJmis5XD@zx2c4.com> (raw)
In-Reply-To: <397f9865-c4ad-44be-91ab-9764fe3aeb89@csgroup.eu>
On Tue, Aug 27, 2024 at 10:46:21AM +0200, Christophe Leroy wrote:
> > +/**
> > + * __arch_chacha20_blocks_nostack - Generate ChaCha20 stream without using the stack.
> > + * @dst_bytes: Destination buffer to hold @nblocks * 64 bytes of output.
> > + * @key: 32-byte input key.
> > + * @counter: 8-byte counter, read on input and updated on return.
> > + * @nblocks: Number of blocks to generate.
> > + *
> > + * Generates a given positive number of blocks of ChaCha20 output with nonce=0, and does not write
> > + * to any stack or memory outside of the parameters passed to it, in order to mitigate stack data
> > + * leaking into forked child processes.
> > + */
> > +extern void __arch_chacha20_blocks_nostack(u8 *dst_bytes, const u32 *key, u32 *counter, size_t nblocks);
>
> For Jason: We all redefine this prototype, should we have it in a
> central place, or do you expect some architecture to provide some static
> inline for it ?
Given the doc comment and such, that would be nice. But I didn't see a
straight forward way of doing that when I tried before. If you want to
try and send another fixup commit, that'd be welcomed.
> > +#define __VDSO_RND_DATA_OFFSET 480
> > +
>
> How is this offset calculated or defined ? What happens if the other
> structures grow ? Could you use some sizeof(something) instead of
> something from asm-offsets if you also need it in ASM ?
FYI, there's a similar static calculation like this in the x86 code:
+#if !defined(_SINGLE_DATA)
+#define _SINGLE_DATA
+DECLARE_VVAR_SINGLE(640, struct vdso_rng_data, _vdso_rng_data)
+#endif
> > uname_M := $(shell uname -m 2>/dev/null || echo not)
> > -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
> > +ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/ -e s/aarch64.*/arm64/)
>
> > SODIUM := $(shell pkg-config --libs libsodium 2>/dev/null)
> >
> > TEST_GEN_PROGS := vdso_test_gettimeofday
> > @@ -11,7 +11,7 @@ ifeq ($(ARCH),$(filter $(ARCH),x86 x86_64))
> > TEST_GEN_PROGS += vdso_standalone_test_x86
> > endif
> > TEST_GEN_PROGS += vdso_test_correctness
> > -ifeq ($(uname_M),x86_64)
> > +ifeq ($(uname_M), $(filter x86_64 aarch64, $(uname_M)))
>
> Does that work for you when you cross-compile ? For powerpc when I cross
> compile I still get the x86_64 from uname_M here, which is unexpected.
That sounds like a legitimate bug you're pointing out, but not one with
Adhemerval's code, right? Rather, it's something to be fixed inside of
these self tests as a whole?
Jason
next prev parent reply other threads:[~2024-08-27 8:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-26 18:10 [PATCH] aarch64: vdso: Wire up getrandom() vDSO implementation Adhemerval Zanella
2024-08-26 20:27 ` Jason A. Donenfeld
2024-08-27 13:17 ` Adhemerval Zanella Netto
2024-08-27 13:34 ` Jason A. Donenfeld
2024-08-27 13:39 ` Adhemerval Zanella Netto
2024-08-27 14:00 ` Christophe Leroy
2024-08-27 14:01 ` Adhemerval Zanella Netto
2024-08-27 14:10 ` Christophe Leroy
2024-08-27 14:14 ` Adhemerval Zanella Netto
2024-08-27 14:28 ` Jason A. Donenfeld
2024-08-27 14:30 ` Adhemerval Zanella Netto
2024-08-27 14:32 ` Jason A. Donenfeld
2024-08-27 14:35 ` Adhemerval Zanella Netto
2024-08-27 14:41 ` [PATCH] selftests/vDSO: separate LDLIBS from CFLAGS for libsodium Jason A. Donenfeld
2024-08-27 14:45 ` Adhemerval Zanella Netto
2024-08-27 14:52 ` Jason A. Donenfeld
2024-08-27 13:52 ` [PATCH] aarch64: vdso: Wire up getrandom() vDSO implementation Christophe Leroy
2024-08-26 20:55 ` Jason A. Donenfeld
2024-08-27 8:46 ` Christophe Leroy
2024-08-27 8:53 ` Jason A. Donenfeld [this message]
2024-08-27 15:16 ` Jason A. Donenfeld
2024-08-27 15:18 ` [PATCH] random: vDSO: move prototype of arch chacha function to vdso/getrandom.h Jason A. Donenfeld
2024-08-27 15:47 ` [PATCH v2] " Jason A. Donenfeld
2024-08-27 16:53 ` Christophe Leroy
2024-08-27 16:55 ` Jason A. Donenfeld
2024-08-27 14:07 ` [PATCH] aarch64: vdso: Wire up getrandom() vDSO implementation Adhemerval Zanella Netto
2024-08-27 13:51 ` Ard Biesheuvel
2024-08-27 14:00 ` Mark Rutland
2024-08-27 14:05 ` Adhemerval Zanella Netto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zs2UGH6xjJmis5XD@zx2c4.com \
--to=jason@zx2c4.com \
--cc=adhemerval.zanella@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=ebiggers@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tytso@mit.edu \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox