From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 F2C4A6FA1 for ; Wed, 30 Nov 2022 17:00:10 +0000 (UTC) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669827608; 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=jjMJHHMyqhLkfdRT9iuq6XDxjOMpNYWRh37e3CUD8CA=; b=myw6xp0Dnh3wwdR9mqSMUGj3QLWVHrv3/yXT7NjbHjRyxY9pUsSss8Z8aQM9P2DmDPrhaM eWMFC84xT/a0H4sxUxGZUZ6yCGiAFB2e3GLuEx91WZcQxNgk/jUYPyCEXek2Kbyz4+jrzN Wr9+ncWyqDUTrtelfTt7aay3V0OXjsIEGltNPxEtRvm4ghKJ2P+hheZ7edosjd5QsxX6lK LIy59LGxYxAS2FYQhXap3hW8STItheNzupoh3THyZGDzOXa0civJEj+W7l92jvSdiNHsVh ymyJ4T7P1Bfn4ftp8M2KogW7kNeRThl2pVhz5bFd7flBvtnt0r77x1YbEy/1ag== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669827608; 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=jjMJHHMyqhLkfdRT9iuq6XDxjOMpNYWRh37e3CUD8CA=; b=DcLE/BRRpt3HcZ/qS1N/9ABGBGH7ajSS8N2HyEb/sZFissGqPJYdutBNvp1kCdXlBIYuWK +ohCGzV0qQNKpgCA== To: "Jason A. Donenfeld" , Arnd Bergmann Cc: Florian Weimer , linux-kernel@vger.kernel.org, patches@lists.linux.dev, 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 In-Reply-To: References: <20221129210639.42233-1-Jason@zx2c4.com> <20221129210639.42233-4-Jason@zx2c4.com> <878rjs7mcx.fsf@oldenburg.str.redhat.com> <16ec2a7a-c469-4732-aeca-e74a9fb88d3e@app.fastmail.com> <574ad32d-566e-4c18-a645-1470fc081ede@app.fastmail.com> Date: Wed, 30 Nov 2022 18:00:07 +0100 Message-ID: <8735a0tm20.ffs@tglx> Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Wed, Nov 30 2022 at 16:47, Jason A. Donenfeld wrote: > On Wed, Nov 30, 2022 at 4:29 PM Arnd Bergmann wrote: >> I see what you mean now. However this means your vdso32 copies >> are different between 32-bit and 64-bit kernels. If you need to >> access one of the fields from assembler, it even ends up >> different at source level, which adds a bit of complexity. >> >> Making the interface configuration-independent makes it obvious >> to the reader that none of these problems can happen. > > Except ideally, these are word-sized accesses (where only compat code > has to suffer I suppose). While I hate it with a passion, there is actually a valid reason to use this ugly typedef. On 32bit architectures which have load/store tearing of 64bit variables into two 32bit accesses due to ISA limitations, that results in undefined behaviour when write and read are concurrent. Neither READ_ONCE() nor WRITE_ONCE help there. Though that begs the question whether we need a 64bit generation counter for the VDSO at all. Thanks, tglx