From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7158199397; Mon, 26 Aug 2024 20:27:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724704036; cv=none; b=px0NUX3zMqQu94yJK81ecYqNwtwfGz4iRVGBFtHQufbHBLRK3GWl0PasL7/yaWB3Nududa2i4prxzkZ1/NV0YtuF3WGqElumhq0/0PHFxzVjxH3R+LAHjSyic+rxDdilvRdX6EeWJZ1YB1RF0umfOlGOgmggZhRobnRg+axuZ0E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724704036; c=relaxed/simple; bh=FX345O6/JguLTF/FT4gs65xFBa2XvRMMwKnsN9PxgBo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=n3+v2hNgT3RzxcjZQLa26bTuwKW+0sZaDIT6JC3Rg8uyoK6g7E1mO+jrLqyFz9rzbCB6u6AhZo0HJeE5PGn/fvKC/Sw3K6gYPFjMmluxM1kke5/CVNvBE1JvHRtzKBTz1VRdhB/Gxdtx8vRwVr6kcaG/8LMzW9PTmf6IPS2NjaA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b=caZGUDrc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="caZGUDrc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D155C4DDF9; Mon, 26 Aug 2024 20:27:14 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="caZGUDrc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1724704032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2FEe3aKLdWuHYLE28CB3LaS38AzrFR6662Em9zizChs=; b=caZGUDrcn0gM8EL2MoGDV3cY3R3BGbgE+fhBXHKdGCtNPEsd9PwDV5a/S6A884nQ31c+Om rWKCQc9OQesSRecgUtNOhPJSWjAXeE4CaodO1T3DJ6Xu1XYG2q6jTeiSqBImGkUE2Mu8ug sTfJRxd05byZW0MfbngTj2GJVTxpdR4= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 5e04d8d8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 26 Aug 2024 20:27:11 +0000 (UTC) Date: Mon, 26 Aug 2024 22:27:04 +0200 From: "Jason A. Donenfeld" To: Adhemerval Zanella Cc: Theodore Ts'o , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Catalin Marinas , Will Deacon , Thomas Gleixner , Eric Biggers , Christophe Leroy Subject: Re: [PATCH] aarch64: vdso: Wire up getrandom() vDSO implementation Message-ID: References: <20240826181059.111536-1-adhemerval.zanella@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240826181059.111536-1-adhemerval.zanella@linaro.org> Hi Adhemerval, Thanks for posting this! Exciting to have it here. Just some small nits for now: On Mon, Aug 26, 2024 at 06:10:40PM +0000, Adhemerval Zanella wrote: > +static __always_inline ssize_t getrandom_syscall(void *buffer, size_t len, unsigned int flags) > +{ > + register long int x8 asm ("x8") = __NR_getrandom; > + register long int x0 asm ("x0") = (long int) buffer; > + register long int x1 asm ("x1") = (long int) len; > + register long int x2 asm ("x2") = (long int) flags; Usually it's written just as `long` or `unsigned long`, and likewise with the cast. Also, no space after the cast. > +#define __VDSO_RND_DATA_OFFSET 480 This is the size of the data currently there? > #include > #include > #include > +#include > +#include Possible to keep the asm/ together? > + * ARM64 ChaCha20 implementation meant for vDSO. Produces a given positive > + * number of blocks of output with nonnce 0, taking an input key and 8-bytes nonnce -> nonce > -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))) > TEST_GEN_PROGS += vdso_test_getrandom > ifneq ($(SODIUM),) > TEST_GEN_PROGS += vdso_test_chacha You'll need to add the symlink to get the chacha selftest running: $ ln -s ../../../arch/arm64/kernel/vdso tools/arch/arm64/vdso $ git add tools/arch/arm64/vdso Also, can you confirm that the chacha selftest runs and works? Jason