Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2484482rwb; Wed, 30 Nov 2022 07:12:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf7tzRlmCM9O/974oqI8jShTSuJOR6xwxurN2UadSqR3Qo82h6pTIuuxw7iLCAuhuG461U+o X-Received: by 2002:a17:90a:4605:b0:218:7dd7:ad4c with SMTP id w5-20020a17090a460500b002187dd7ad4cmr63139882pjg.224.1669821121192; Wed, 30 Nov 2022 07:12:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669821121; cv=none; d=google.com; s=arc-20160816; b=XIvNIBjQoVKUhVonyzLZ5HS7Cuwv2PqlBmsHwZ3yVE0bXNYfEjxijHvRssSFnANLBI G6XiRSoDWPohRADT7EbFEWlC0cuUoe76PBnnMqKAvF1sOrVSolwf/dMa3LD/aOxO2UxN 94Z33XRMAgqjlP1tRjaGItsaetiNW0zZwD/TqQdVlJxIl3bE6XRbzSKsRelH3TDgMA1M s9Q8IDf+L+05lSHWYq3fEJnCUwfpYevgUP0CPjB8HkjKNK4OZT0cOX9CLt20SKV/3GmN 2qczU+5v4CXIh/hUttgSD+rVO5zqP+XzbC+FfBgOggqXkCh9iG/zoVp9dpOAfpOmyibf 7Ypw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=EYBohq7Wmj/uFHqGx3hCuQfFGuTEIDd6kMXNccH+gNw=; b=GtSjzT50tfx3D7R9bYNLh1h7vQiQ73b45N+C/vsftDBC9gngFDdo56WYZuuQ3J3FTp 25GtuwvgvKpOaHVxbiLmjXfHizdrHHJ5Gr+/vkRicABMEUeVlKdYCWPPcFCRn58sGfXt RzkihpD4niiVoH0B66TNrUhfI0JxrT4Zt99wmJ8lQidoVraafgaDU9fdrdiQbd8iAjUf wliYEaqjaAVhO7IFONeXF7RrTK19XHwl0etVpfOgqpfqgbHH+G/J4w8K7DLQb2tzIldc P9wt3stFJTswXxDEd+xMsSsUMttRC/rQMMVvtpZ9jtqOm2ToppxJgj98r6XoK8HDtuvX LCgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=GDUdx+Gj; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=A1flL476; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cd5-20020a056a00420500b0056ed0d35397si1802411pfb.184.2022.11.30.07.11.44; Wed, 30 Nov 2022 07:12:01 -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=@arndb.de header.s=fm1 header.b=GDUdx+Gj; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=A1flL476; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229682AbiK3PHw (ORCPT + 99 others); Wed, 30 Nov 2022 10:07:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbiK3PHv (ORCPT ); Wed, 30 Nov 2022 10:07:51 -0500 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BECAD13F58; Wed, 30 Nov 2022 07:07:49 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 211863200918; Wed, 30 Nov 2022 10:07:48 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Wed, 30 Nov 2022 10:07:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1669820867; x=1669907267; bh=EYBohq7Wmj /uFHqGx3hCuQfFGuTEIDd6kMXNccH+gNw=; b=GDUdx+GjmEKduBDSilj+n1NSbq Ic269td72thVocWg+G4micCeNOnsNyYyY4jbe32JM9KaxP3/HY715S6euRzl+OHM vvP+p/DD8NJa2LIAXh9AAqgR9FWQsGlcFQ/cYyQ65Ew2hLxpbng8K+KpuGfucXDX KYCEjcOfukOVqfYxVtv+4UPg+4twU4BFjYlHZ1+4uTUodumLkwFmsUexfCE4NQ/E 8rCZg7ulhiE6NT5uT7tuB8XRHYGJjApwLHWVw6nU2UZP4CcoKKH6ap82W4pSnHzR ndwDTRKc3SljqM6y98atShVleNRl8pjLcwXHwnriopbaLH/Qw3SX0EKfR2qA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1669820867; x=1669907267; bh=EYBohq7Wmj/uFHqGx3hCuQfFGuTE IDd6kMXNccH+gNw=; b=A1flL476eQAuzf8UkuooY5DxSucqSeE95cwMSYX0kTEg SzBwA2GK6ljdkdkwdorqSBZtoZ2TP4Zdo/4dGYiZkqZVuQeV5+DlSKCHwYl3UYA2 56HApMp86ss11am5cqJ2xITBAz/pM4yqD1Bi8T21G9zU6FLRdHN2kITMFTNw1ncL kFchvmlT5D4pSQy4AVip1T4rQ7s1qiAwc5n2XQoHgcyq6+XzMGlXWjJXTLhmrQHo civsyuYklJ2Fth64UNKk7p1Q16WPCoA2ranGOgnKFi3KtITN3jxWxlmOWxrE7zBG ZAVExXIaQz0zXNQ1nMBytulZyJQiZhYXQ26NLP5QUg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrtdefgdejudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdetrhhn ugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrghtth gvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedtkeet ffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrh hnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 5A85BB60086; Wed, 30 Nov 2022 10:07:47 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1115-g8b801eadce-fm-20221102.001-g8b801ead Mime-Version: 1.0 Message-Id: <16ec2a7a-c469-4732-aeca-e74a9fb88d3e@app.fastmail.com> In-Reply-To: References: <20221129210639.42233-1-Jason@zx2c4.com> <20221129210639.42233-4-Jason@zx2c4.com> <878rjs7mcx.fsf@oldenburg.str.redhat.com> Date: Wed, 30 Nov 2022 16:07:27 +0100 From: "Arnd Bergmann" To: "Jason A . Donenfeld" , "Florian Weimer" Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, "Thomas Gleixner" , linux-crypto@vger.kernel.org, linux-api@vger.kernel.org, x86@kernel.org, "Greg Kroah-Hartman" , "Adhemerval Zanella Netto" , "Carlos O'Donell" , "Christian Brauner" Subject: Re: [PATCH v10 3/4] random: introduce generic vDSO getrandom() implementation Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, 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 On Wed, Nov 30, 2022, at 15:59, Jason A. Donenfeld wrote: > On Wed, Nov 30, 2022 at 03:51:01PM +0100, Jason A. Donenfeld wrote: >> On Wed, Nov 30, 2022 at 11:44:30AM +0100, Florian Weimer wrote: >> > >> > * vdso_data will be accessed by 64 bit and compat code at the same time >> > * so we should be careful before modifying this structure. >> > >> > So the ABI must be same for 32-bit and 64-bit mode, and long isn't. > I'll do something like this: > > > +#ifdef CONFIG_64BIT > +typedef u64 vdso_kernel_ulong; > +#else > +typedef u32 vdso_kernel_ulong; > +#endif This does not address the ABI concern: to allow 32-bit and 64-bit tasks to share the same data page, it has to be the same width on both, either u32 or 64, but not depending on a configuration option. > struct vdso_rng_data { > vdso_kernel_ulong generation; > bool is_ready; > }; There is another problem with this: you have implicit padding in the structure because the two members have different size and alignment requirements. The easiest fix is to make them both u64, or you could have a u32 is_ready and an explit u32 for the padding. Arnd