Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1350887rwb; Fri, 18 Nov 2022 17:17:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf4B2YgrwhqwqRshbn/hxvFSH5osZcJNi2f/bnqyof3s8t8VtyD6QivBfMT2QEyi5roKcjgR X-Received: by 2002:a17:906:cf85:b0:78d:b66d:749f with SMTP id um5-20020a170906cf8500b0078db66d749fmr7724965ejb.566.1668820664315; Fri, 18 Nov 2022 17:17:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668820664; cv=none; d=google.com; s=arc-20160816; b=U5IntSzSJh880z5ET7dO4QbFGOKjdj+yq0fzzDIGlppVeyjU10Ka0UyZHpLsL6DDvk 4tUTBnKwJaLFBTSFlv8n0GRdyv1tuUykt2IOTIz6k0XWuU+i0ZatvWTJxzfvZaFmD1i+ Kgr/mvnlyzYcmH6t+cL0Pg6be83U2PebWN8U2QU0ybyc9UocljjCWT8Nn2JGUBD+2meI 6kIBnGEHLl26eChStQKoJasy8D+eRXCS8yKzoURMrbLLXX+7yFlGx9zpMTMSL3Uy6Zso FxTTry1cJmG79Lf964hJ6QrC3m35pBuQHTXvDcMoKDt5k6j0+xz0ujJ6asoZw/Tb5tFz 9PHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=R01k3COoUWqwZPp44f3ibDLlpDtWB8ifsqMAbjnVS7w=; b=M36X9iK5vhAafTKMQRbdtTB4cb2KZoJa2lzgg33EiugX22LxX3I3U/OcsGhBjg8EVP yyxkpF+88IAdgQRv3myUoqGCI5r97m4Sc7+OWbxy+xIzWSs+gBvfsShlSbeRzSR0+qEZ 4ENyvzHT49StFiW3so+Um4JFCUqeqnjrTJ029A4mtZz9MM6/z65c139otF90TAs6fH3g 9kXKk3bnkteVXAnXN2WW+OSjEWxOcTQG3kUBcUosLu7jJXC/W1kpQWC1YP7uHAjV5oJV iQTwqVj2pdM4glML9wpUZJamC/e89ggZMEpzQsABcr1gneM42r+Lu3whjGZNJtk20YtJ 4Wug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=BUBW6s5H; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b18-20020a056402351200b0046314dd20a0si4947466edd.3.2022.11.18.17.17.13; Fri, 18 Nov 2022 17:17:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=BUBW6s5H; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234404AbiKSA6v (ORCPT + 99 others); Fri, 18 Nov 2022 19:58:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234686AbiKSA4h (ORCPT ); Fri, 18 Nov 2022 19:56:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2C1213B33E; Fri, 18 Nov 2022 15:55:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D61F614FB; Fri, 18 Nov 2022 23:55:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FDF0C433D6; Fri, 18 Nov 2022 23:55:09 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="BUBW6s5H" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1668815706; 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=R01k3COoUWqwZPp44f3ibDLlpDtWB8ifsqMAbjnVS7w=; b=BUBW6s5H2iPdiVuOv32UIdmPGYE9iLtyMIjzmgUjx1IG+b8OqGccu1v5s/5K5426Jv8Q5U DH85hHqOPyT/htMIliRmk72NFgbThjAj5B2NNyuFB070P7FZNo6mQvLkgIRi9Mgug3HTAy V/8hwbP2IdJER09B+N4I1FZL6K2db0k= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id a537b333 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 18 Nov 2022 23:55:05 +0000 (UTC) Date: Sat, 19 Nov 2022 00:55:02 +0100 From: "Jason A. Donenfeld" To: Christophe Leroy Cc: "linux-kernel@vger.kernel.org" , "patches@lists.linux.dev" , "linux-crypto@vger.kernel.org" , "x86@kernel.org" , Thomas Gleixner , Greg Kroah-Hartman , Adhemerval Zanella Netto , Carlos O'Donell Subject: Re: [PATCH v4 2/3] random: introduce generic vDSO getrandom() implementation Message-ID: References: <20221118172839.2653829-1-Jason@zx2c4.com> <20221118172839.2653829-3-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Christophe, On Fri, Nov 18, 2022 at 07:34:26PM +0000, Christophe Leroy wrote: > > +static __always_inline ssize_t > > +__cvdso_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state) > > +{ > > + struct vgetrandom_state *state = opaque_state; > > + const struct vdso_rng_data *rng_info = __arch_get_vdso_rng_data(); > > In order to ease wiring up to powerpc, can it be done the same way as > commit e876f0b69dc9 ("lib/vdso: Allow architectures to provide the vdso > data pointer") It is already. At least I think it is, unless I'm missing a subtle distinction? The call to __arch_get_vdso_rng_data() goes to arch-specific code, implemented in the 3/3 of this patch set for x86 inside of arch/x86/include/asm/vdso/getrandom.h. On powerpc, you'd make a powerpc-specific __arch_get_vdso_rng_data() instead of arch/powerpc/include/asm/vdso/getrandom.h. Or maybe I'm not reading that commit right? The commit message says something about __arch_get_vdso_rng_data() being problematic because of clobbering a register, but then the same commit still seems to call __arch_get_vdso_rng_data()? Is this one of those things where what you'd prefer is that I define an inline function, __cvdso_get_vdso_rng_data(), that by default calls __arch_get_vdso_rng_data(), but can be overridden on powerpc to do some other type of magic? But __arch_get_vdso_rng_data() is already an overiddable inline, so what would the difference be? Sorry if I'm a bit slow here to grok what's up. Jason