Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8778486rwb; Thu, 24 Nov 2022 04:17:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Ra/Bd1YgTrQTAhLYvgo2lrICLyzFxegHbRavpW2GBdN+AAqiwITBzG2CWMKaGynxCQU0D X-Received: by 2002:a17:906:c249:b0:7ad:9f03:fd44 with SMTP id bl9-20020a170906c24900b007ad9f03fd44mr12453190ejb.73.1669292236716; Thu, 24 Nov 2022 04:17:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669292236; cv=none; d=google.com; s=arc-20160816; b=KMAN0NT35guZcsVnXzAqRPpePcag8oOT0hwK9nwzBn8/Q35AsbMj30jyEhf2vrFhCU VXaBlxqKMwVztjmqKeF6fr2RQddY3gXupp5RZwwpXou0tbRQ/79QtoQ0TH2cmE7s1yrW hn9KcDFCsw5Wn4yUEbbV8vbNs05xkt1MbmfjSvdpee60WvolLEXp0dFp5DDTVkV950MT OHXz1kVZHlWx9U3SvEh4TGflgDHvFZsEOwPyxkAGIxjeTv1m66EUJSYIQp+0M78rFSyr ZFDgoFvFzYncqA4NnuFJ9sIwmws3K3QHBm0xdQ2ZYyt/9/wgcqBSN/gKOzMX2zAbXsmx eiIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=LhtIcas2JvUNRz550Pp/W/2twet/oq84mZGa4a40f8g=; b=SoNvSE9JvoM+pbLXEZUnd9RZAGH7nseaIy+zVDFZrmjn8y6FvN0NfG0XgMWH6RR5WV oH8JsL14Zsq5KqMsqkmVJfYnJcY3vGADiCQKL5alpTnmBvunPvhYItU4FLy2pa8yYSBA d/IhW0dgCMtTYIlC4Vd4n+pKJPC9vedM8CHHzgvqdUoNYDNxypEHy9P6vcBsSs/zDwV2 azLyr1Dxzi3vAIdXjil1jqJy2kEh//mKpcSuCstbB/qFAMU0YBEAp+6W2u93vJXDkgAF qzqcPXfNWHYq3vcnTlgYTtdC02/xOqb+X2VYa0L6iViPLKJ0q44NjTomgk9T586sBP2T uqMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gyAIDQNL; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw14-20020a1709066a0e00b0078dacbcaa7asi733815ejc.992.2022.11.24.04.16.51; Thu, 24 Nov 2022 04:17:16 -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=@redhat.com header.s=mimecast20190719 header.b=gyAIDQNL; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229558AbiKXMQ3 (ORCPT + 99 others); Thu, 24 Nov 2022 07:16:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbiKXMQ3 (ORCPT ); Thu, 24 Nov 2022 07:16:29 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26C61748F0 for ; Thu, 24 Nov 2022 04:15:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669292133; 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=LhtIcas2JvUNRz550Pp/W/2twet/oq84mZGa4a40f8g=; b=gyAIDQNLCFpz+ZVFnQt3rakvc9VzNGbvyQP4ZlhFWDces0IwHMc0h5C3yleWrlbzAbPoXO wxuS9L8pfxrhzNGAsuxygu9Bky2ymHt/fFXkkIbwHrDTeS64RQ0BCjDizfqPcDBbqXq3f7 gHI9gOi32Ki7b/TgLeF38IefUdAtGZ8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-530-hMsbhpb2MNSqF7_u8UQDNw-1; Thu, 24 Nov 2022 07:15:30 -0500 X-MC-Unique: hMsbhpb2MNSqF7_u8UQDNw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ACA9C8027FE; Thu, 24 Nov 2022 12:15:29 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DE4B22166B33; Thu, 24 Nov 2022 12:15:27 +0000 (UTC) From: Florian Weimer To: "Jason A. Donenfeld" 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 References: <20221121152909.3414096-1-Jason@zx2c4.com> <20221121152909.3414096-2-Jason@zx2c4.com> <87v8n6lzh9.fsf@oldenburg.str.redhat.com> <87a64g7wks.fsf@oldenburg.str.redhat.com> Date: Thu, 24 Nov 2022 13:15:24 +0100 In-Reply-To: (Jason A. Donenfeld's message of "Thu, 24 Nov 2022 13:03:26 +0100") Message-ID: <87cz9c5z1f.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 * Jason A. Donenfeld: > Hi Florian, > > On Thu, Nov 24, 2022 at 06:25:39AM +0100, Florian Weimer wrote: >> * Jason A. Donenfeld: >> >> > 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. >> >> See clone3 and struct clone_args. > > The struct is one thing. But actually, clone3 takes a `size_t`: > > SYSCALL_DEFINE2(clone3, struct clone_args __user *, uargs, size_t, size) > > I take from this that I too should use `size_t` rather than `unsigned > long.` And it doesn't seem like there's any compat clone3. But vgetrandom_alloc does not use unsigned long, but unsigned long *. You need to look at the contents for struct clone_args for comparison. Thanks, Florian