Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5458211pxb; Wed, 26 Jan 2022 12:26:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcM23j62oe4DcP3uW32K0vnpIouAaEAB/qAC50xKV0pd/k+27ldvukeybF8xo/F2vEVvFb X-Received: by 2002:a17:90a:e7ca:: with SMTP id kb10mr10396219pjb.234.1643228807288; Wed, 26 Jan 2022 12:26:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643228807; cv=none; d=google.com; s=arc-20160816; b=PZNKr5aybdXljssJZqc47An3q+s2uZ+qERggD7AhmFzEl2g/LKedErocyTrVStx1m8 0vgDQhfc/JxWFCG6Pr6vwdqwZv8aYk+ik0f//f+/U8w/2jHtUn9XAp1UyF/rmG90voPu gWHTJNW4GhbfUqdFNGzlnlStRarxHSwG8UsJJfGbx1jiwTtACHVRKgxWRwV6HrIUTjZk Imy1hVYbu0oFRG9ifKxmq/zN371YKbZggm94UTSioXJWk0j1B2kqUBv7vjTHT7DKV4WN WOKEnlTh757n3QL6OtmoyWsyxoNMYToVbFFRkjaKoIuudsIW+bYVnR2B6+f1g1vz2tkj B18A== 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=X75aAZ51R8YWkBiD6jrwwSCKxG0nBPXSyboKwgJDKc0=; b=bhZ88YIskK3BjgqBbRIoo/Otjjqo2TrIIyFpUtBrYZWEM3C1xx0cRtIMndT2eBjQ4L v9btk0kZNK6HDvI6c7E8FpHZ2ue98AQI7gKiY2UJhMXgZmHhNZJr8chkSV7kqPDPs3vd NpC8XmAT3rnpzCagWE6myMu5aVXVySPuGXnAuVqKZ1d9yYTK3Tmt7Q+wIvGjfmF6Mmkr ZOcuza/fxqwcrN8S2p1RTDy92IPpdhEaCTjzoXzR0qQipX76AsLH67diWBsPTZ/WAS/9 9MScOekmMcKp4FVM3VYBcRoZF49G3LcZKJtf8L31WaJmEeJ6fjPR1H5WKbC0uqfRI13z hlpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pqneUEtD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si224576pgc.103.2022.01.26.12.26.35; Wed, 26 Jan 2022 12:26:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pqneUEtD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238117AbiAZIDk (ORCPT + 99 others); Wed, 26 Jan 2022 03:03:40 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56190 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229947AbiAZIDj (ORCPT ); Wed, 26 Jan 2022 03:03:39 -0500 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 C3FC5B80E58; Wed, 26 Jan 2022 08:03:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7DBBC340E3; Wed, 26 Jan 2022 08:03:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643184216; bh=+vHH6coBn+fxyHOUtpoTMk9tkgCZPRFerUEzgh3lC0M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pqneUEtDGDJuawtt4SeTc2xgeRMWSuDfz7221pvgZgzE/Hbz5WqBA4L7U2b4ksZBM W3uPKQ/98bUEYNleUcCSuSuM3RA5lQvgBPK7MERY8oZjHuzo7WUMAhyVQa4KmJ1kEh MXrpJLDDKqkGdk3uGT5XgSz9ZUyAmN4BxAXwKVrRrBCgjx70bWGj74oGZ1W66Ypcs6 fxg8i0UFLCMIf3JXciiOKRnpAY9kZk41FKgDj2hV5OUxSmVNtUpDwDEwh8maVOVGmC 5OE/PNGoEXw4PAt8hGfw5s0wGhmEurmz7IE0V0IpT34+JZrRFoO/nBQRmZzru9PGTp EXCOueL0g0Vqg== Date: Wed, 26 Jan 2022 09:03:27 +0100 From: Christian Brauner To: Mathieu Desnoyers Cc: Thomas Gleixner , linux-kernel , Peter Zijlstra , paulmck , Boqun Feng , "H. Peter Anvin" , Paul Turner , linux-api , shuah , linux-kselftest , Florian Weimer , Andy Lutomirski , Dave Watson , Andrew Morton , Russell King , Andi Kleen , Christian Brauner , Ben Maurer , rostedt , Josh Triplett , Linus Torvalds , Catalin Marinas , Will Deacon , Michael Kerrisk , Joel Fernandes Subject: Re: [RFC PATCH 02/15] rseq: Remove broken uapi field layout on 32-bit little endian Message-ID: <20220126080327.4g4pkv3haenxt2m6@wittgenstein> References: <20220124171253.22072-1-mathieu.desnoyers@efficios.com> <20220124171253.22072-3-mathieu.desnoyers@efficios.com> <20220125122156.v2f5anzcs35i3rii@wittgenstein> <1234069751.70438.1643121673355.JavaMail.zimbra@efficios.com> <1445357149.71067.1643137248305.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1445357149.71067.1643137248305.JavaMail.zimbra@efficios.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 02:00:48PM -0500, Mathieu Desnoyers wrote: > ----- On Jan 25, 2022, at 9:41 AM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote: > > > ----- On Jan 25, 2022, at 7:21 AM, Christian Brauner brauner@kernel.org wrote: > [...] > >>> include/uapi/linux/rseq.h | 17 ++++------------- > [...] > >>> union { > >> > >> A bit unfortunate we seem to have to keep the union around even though > >> it's just one field now. > > > > Well, as far as the user-space projects that I know of which use rseq > > are concerned (glibc, librseq, tcmalloc), those end up with their own > > copy of the uapi header anyway to deal with the big/little endian field > > on 32-bit. So I'm very much open to remove the union if we accept that > > this uapi header is really just meant to express the ABI and is not > > expected to be used as an API by user-space. > > > > That would mean we also bring a uapi header copy into the kernel > > rseq selftests as well to minimize the gap between librseq and > > the kernel sefltests (the kernel sefltests pretty much include a > > copy of librseq for convenience. librseq is maintained out of tree). > > > > Thoughts ? > > Actually, if we go ahead and remove the union, and replace: > > struct rseq { > union { > __u64 ptr64; > } rseq_cs; > [...] > } v; > > by: > > struct rseq { > __u64 rseq_cs; > } v; > > expressions such as these are unchanged: > > - sizeof(v.rseq_cs), > - &v.rseq_cs, > - __alignof__(v.rseq_cs), > - offsetof(struct rseq, rseq_cs). > > So users of the uapi rseq.h (as an API) can still use rseq_abi->rseq_cs before > and after the change. > > Based on this, I am inclined to remove the union, and just make the rseq_cs field > a __u64. > > Any objections ? I do like it fwiw. But since I haven't been heavily involved in the userspace usage of this I can't speak confidently to the regression potential of a change like this. But I would think that we should risk it instead of dragging a pointless union around forever.