Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3535900pxb; Mon, 24 Jan 2022 11:39:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOWU7F47H1W5UKx5ous2ZY9TfoGASm9weoWFxtBERwfjX/ZzipLx8unL3lMr8M9+taYWaH X-Received: by 2002:a17:90b:314e:: with SMTP id ip14mr3392780pjb.213.1643053162523; Mon, 24 Jan 2022 11:39:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643053162; cv=none; d=google.com; s=arc-20160816; b=vxgoZ7gTub80JoxkeVH2FbVhjzEXcK3HX3tmPr60TY3M7zqCHXVQnn1aLoGo03JO5h hrkNtzJGvs3ra43jACBiGLgmonOj8vaLyHLw/RyqpgA0aNnVtzZwoEcMqEaSP/vNJDRj EPIG8DJnqjsSvbF4LkNkK6246NjTioJUHnmiK9rz6kapLFZ5VyqbR93rTyU3vCyb71ZW 8ovXKTIBNef4oezfS0mhK1z6EJB34QvNlg+PHPqB32Un3xkly9H8iqfrY46HvGL09X0l HfRWm3iedug0a8+5SpkGCx0GbQF/5o50aFkscyAbxIBVLQainmvwsCHERxRGO6ZiQmYe Y7Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature:dkim-filter; bh=QZvezDQALaTHaG2wsjFfFZR4oEmsMYs7JU1mR/0rfU0=; b=OQFQH8J+CRvac2W+yUf05qEbZ1gYK+yviiLny+gteVD73mTxN41zRUCVrsbZIujplz HgTn88zzv/i9xUqsVjZtUQ7OpLbh4I6NEopXyEOeHkmaMBjyz1oom3aDypbXpIZ7eRLw 5vPs8yyr6hPfpJ7Gl9J2ZyTqIHiQfazGfjff9O0A+dvXEiABy06xxDt8tQ0t53rYhGU1 Wg1ZSosOYD1y18R3PKcmVtznn+bCkZwWjSkwQCBiCMKIj/cb49KRfT8tMxU7wsKksXYY mNFiWlqfAXmpDDgxBU86VQdFu1L3kBumA4b4s2lldlv9PsHn+UAji/AsexTvgiA1eP+7 Nv0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=Cw2+Z0kU; 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=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k62si10324811pgd.356.2022.01.24.11.39.05; Mon, 24 Jan 2022 11:39:22 -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=@efficios.com header.s=default header.b=Cw2+Z0kU; 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=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244288AbiAXRNW (ORCPT + 99 others); Mon, 24 Jan 2022 12:13:22 -0500 Received: from mail.efficios.com ([167.114.26.124]:47614 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244122AbiAXRND (ORCPT ); Mon, 24 Jan 2022 12:13:03 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 20A57344E5C; Mon, 24 Jan 2022 12:13:03 -0500 (EST) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id HzCnC6gMYFJ3; Mon, 24 Jan 2022 12:13:02 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id AE43534518F; Mon, 24 Jan 2022 12:13:02 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com AE43534518F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1643044382; bh=QZvezDQALaTHaG2wsjFfFZR4oEmsMYs7JU1mR/0rfU0=; h=From:To:Date:Message-Id; b=Cw2+Z0kUT7q0qSnE02duiMtgOez2ml+rEo9bjVfDiOxAcCHx7VU7y1PWiBZlVZdKB Fqq7tqwmkbDI5hjGiKffKhInxPcCRCytebO9dyh751o5peD06/qYphtjg0QCy7kIj4 gXzsuQ39csnlBnWGwGJ1ktGD38eirP4eC8a0h2/X28VnoNoJOKPDxwTx+u+scpyjfr urbOVSEACdpNrDqiIoVLSsIZeAn0KjUZzD6bSL2lUW2SBLhICSk+acEY6+HMuPYaxp 9iN+cM2+MZkMuJxIgh1NaJf1eHDFUv2Yljwsf0olRCtPfu/jfu6f12iCfMMCUBs5eK BNCBNWUnnwr4A== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id FJbTRfNpqL4v; Mon, 24 Jan 2022 12:13:02 -0500 (EST) Received: from localhost.localdomain (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by mail.efficios.com (Postfix) with ESMTPSA id 39585344BF5; Mon, 24 Jan 2022 12:13:02 -0500 (EST) From: Mathieu Desnoyers To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , "Paul E . McKenney" , Boqun Feng , "H . Peter Anvin" , Paul Turner , linux-api@vger.kernel.org, Shuah Khan , linux-kselftest@vger.kernel.org, Mathieu Desnoyers , Florian Weimer , Andy Lutomirski , Dave Watson , Andrew Morton , Russell King , Andi Kleen , Christian Brauner , Ben Maurer , Steven Rostedt , Josh Triplett , Linus Torvalds , Catalin Marinas , Will Deacon , Michael Kerrisk , Joel Fernandes Subject: [RFC PATCH 02/15] rseq: Remove broken uapi field layout on 32-bit little endian Date: Mon, 24 Jan 2022 12:12:40 -0500 Message-Id: <20220124171253.22072-3-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220124171253.22072-1-mathieu.desnoyers@efficios.com> References: <20220124171253.22072-1-mathieu.desnoyers@efficios.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The rseq rseq_cs.ptr.{ptr32,padding} uapi endianness handling is entirely wrong on 32-bit little endian: a preprocessor logic mistake wrongly uses the big endian field layout on 32-bit little endian architectures. Fortunately, those ptr32 accessors were never used within the kernel, and only meant as a convenience for user-space. Remove those and only leave the "ptr64" union field, as this is the only thing really needed to express the ABI. Document how 32-bit architectures are meant to interact with this "ptr64" union field. Fixes: ec9c82e03a74 ("rseq: uapi: Declare rseq_cs field as union, update includes") Signed-off-by: Mathieu Desnoyers Cc: Florian Weimer Cc: Thomas Gleixner Cc: linux-api@vger.kernel.org Cc: Peter Zijlstra Cc: Boqun Feng Cc: Andy Lutomirski Cc: Dave Watson Cc: Paul Turner Cc: Andrew Morton Cc: Russell King Cc: "H . Peter Anvin" Cc: Andi Kleen Cc: Christian Brauner Cc: Ben Maurer Cc: Steven Rostedt Cc: Josh Triplett Cc: Linus Torvalds Cc: Catalin Marinas Cc: Will Deacon Cc: Michael Kerrisk Cc: Joel Fernandes Cc: Paul E. McKenney --- include/uapi/linux/rseq.h | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/include/uapi/linux/rseq.h b/include/uapi/linux/rseq.h index 9a402fdb60e9..31290f2424a7 100644 --- a/include/uapi/linux/rseq.h +++ b/include/uapi/linux/rseq.h @@ -105,22 +105,13 @@ struct rseq { * Read and set by the kernel. Set by user-space with single-copy * atomicity semantics. This field should only be updated by the * thread which registered this data structure. Aligned on 64-bit. + * + * 32-bit architectures should update the low order bits of the + * rseq_cs.ptr64 field, leaving the high order bits initialized + * to 0. */ union { __u64 ptr64; -#ifdef __LP64__ - __u64 ptr; -#else - struct { -#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined(__BIG_ENDIAN) - __u32 padding; /* Initialized to zero. */ - __u32 ptr32; -#else /* LITTLE */ - __u32 ptr32; - __u32 padding; /* Initialized to zero. */ -#endif /* ENDIAN */ - } ptr; -#endif } rseq_cs; /* -- 2.17.1