Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8186394rwb; Wed, 23 Nov 2022 17:09:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Ug+tXNRl+uXIrStV57vEXnIfeKtt6o2axsPHjcWcyqkdqdUGz7yb6qG2jUaCk5cZeC8iA X-Received: by 2002:a63:a65:0:b0:477:ab31:fea6 with SMTP id z37-20020a630a65000000b00477ab31fea6mr7649104pgk.273.1669252175801; Wed, 23 Nov 2022 17:09:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669252175; cv=none; d=google.com; s=arc-20160816; b=dM388D3uDQBlK6Bb8Tr1ObEFdkP3Tgk4CDmyW9DMJm2JtZW8fQIdIz0P2sNaahvC3E PANYq6/f0IjRjdv1ogkHoqlSySFNpy6Jfb8UO983xTasMwPRleVqyDOOrLrsRv9pGP5F udQY5YGhmSBqf6Jl/oAeYKwpliMfT2VqhltLPth/apylAaxn7/VvX+LdGohd7J5nisHH ZRMxo4OxDdPY9E4pxp/uyINskHGt1SNQN3jLT8TN0yj+xcbuPCoRrTLjQGQUqFhzEry4 n7hNoYqkXp8WS9SAuIUi/VC1Yahcz9FJq8i7UIIgZ91Nym5aWICJdj0MDKyRPwu1tNaL 21jQ== 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=yftSFBarwsIAmHDvyINGRo5xUo935YOMsD41b+7z6XU=; b=ZczlLVDTfHVcgonIUpX0yqh7slrGCdOzC+4d3cnDai5HqhgRbYbD5ND4+KOIXcv0c3 VTm4VfGoIc/uyQW0brUxs5yINq9DllfBimwkU1sFy4WaHBzzRy3gokxF9Nqb83L8ym1/ BTMJ+0/In8VE2pjN5GRsb4hONB8Jnb8dAILlj8UBxHAqNf+Ju3w5dlyCIWGQ6xw2WnMK bPAH4RFu7xm4Z0F8dQNq1LmdnecHxJejTq1IhhUgtcKdm+aSVUgMM+k4Yk/z7J3Kqa45 vi4MlVQV7DAG+EeLjWtohoeAnmHxuH9XZ8MNR4e12Ts5rTiaMj97dXycXCHzWgJc1bjJ WOWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=Y2Z4qlgT; 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 oo12-20020a17090b1c8c00b0021406fde039si3540721pjb.156.2022.11.23.17.09.14; Wed, 23 Nov 2022 17:09:35 -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=Y2Z4qlgT; 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 S229449AbiKXBEZ (ORCPT + 99 others); Wed, 23 Nov 2022 20:04:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229687AbiKXBEX (ORCPT ); Wed, 23 Nov 2022 20:04:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD87AD06CE; Wed, 23 Nov 2022 17:04:22 -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 ams.source.kernel.org (Postfix) with ESMTPS id 7996BB825F3; Thu, 24 Nov 2022 01:04:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BC06C433D6; Thu, 24 Nov 2022 01:04:18 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="Y2Z4qlgT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1669251856; 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=yftSFBarwsIAmHDvyINGRo5xUo935YOMsD41b+7z6XU=; b=Y2Z4qlgTpiGXtP1SVXvDkga0N2bcii6cQRPN+0CxD4tNzpCdW4Z6r0c8zFANyJq9R+shjy Kd4Ojo2VS9hRz8cn/SBBa4n67I3/mcatA+Ieu02TUpK6YtV3o2cuJJEv6hPTxXPx01HyO7 NJLzyP4tPcqf9wMwP18O2Dfw8VITBk8= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 405ba4b1 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 24 Nov 2022 01:04:16 +0000 (UTC) Date: Thu, 24 Nov 2022 02:04:13 +0100 From: "Jason A. Donenfeld" To: Florian Weimer Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, tglx@linutronix.de, linux-crypto@vger.kernel.org, x86@kernel.org, Greg Kroah-Hartman , Adhemerval Zanella Netto , Carlos O'Donell Subject: Re: [PATCH v6 1/3] random: add vgetrandom_alloc() syscall Message-ID: References: <20221121152909.3414096-1-Jason@zx2c4.com> <20221121152909.3414096-2-Jason@zx2c4.com> <87v8n6lzh9.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87v8n6lzh9.fsf@oldenburg.str.redhat.com> 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 Florian, On Wed, Nov 23, 2022 at 11:46:58AM +0100, Florian Weimer wrote: > * Jason A. Donenfeld: > > > + * The vgetrandom() function in userspace requires an opaque state, which this > > + * function provides to userspace, by mapping a certain number of special pages > > + * into the calling process. It takes a hint as to the number of opaque states > > + * desired, and returns the number of opaque states actually allocated, the > > + * size of each one in bytes, and the address of the first state. > > + */ > > +SYSCALL_DEFINE3(vgetrandom_alloc, unsigned long __user *, num, > > + unsigned long __user *, size_per_each, unsigned int, flags) > > I think you should make this __u64, so that you get a consistent > userspace interface on all architectures, without the need for compat > system calls. That would be quite unconventional. Most syscalls that take lengths do so with the native register size (`unsigned long`, `size_t`), rather than u64. If you can point to a recent trend away from this by indicating some commits that added new syscalls with u64, I'd be happy to be shown otherwise. But AFAIK, that's not the way it's done. Jason