From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1431C433EF for ; Mon, 24 Jan 2022 11:49:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237924AbiAXLty (ORCPT ); Mon, 24 Jan 2022 06:49:54 -0500 Received: from mail.efficios.com ([167.114.26.124]:48842 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237983AbiAXLtw (ORCPT ); Mon, 24 Jan 2022 06:49:52 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id E32AA3428CE; Mon, 24 Jan 2022 06:49:50 -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 xz0Jvo2HHOPX; Mon, 24 Jan 2022 06:49:50 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 5268C3429C4; Mon, 24 Jan 2022 06:49:50 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 5268C3429C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1643024990; bh=70Ro/A1XGeVG9oQHqw8ICvwdo6uwoHMdEEqIu4jOcjc=; h=Date:From:To:Message-ID:MIME-Version; b=CCTZDNReJNz+g8Q/BAXAtCATWo+ddvis2ieBCNx06veeVI9Z63AOvNgeqs+XpxpSi Pylm5U+q07ZA611ZEozxcFHwAvZntIcP2T/t3joS4b1Zwa4qjAUv/I4YOZljgbmrtG XPL83WbL70b645aDRPd+cTcDW9FCjJZAeTFIMZDFLF5/PR32WygE6hal+q4kU3S6Tl elY6pAMJqv1d+4Lv6R4IktecsOAr0hP+xMtrTT0mg3cW11H5ALQ3f9CyP+TPEixLW4 sVVT6GjFvkrb31gZ19avdTlTeR9kyibc8tN+rHO5vOOE8B/bwoQb6U7dPmTZU2e6Iz Rz99nqIG6oZkQ== 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 wHkc4UUiQWQT; Mon, 24 Jan 2022 06:49:50 -0500 (EST) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 33E473429C3; Mon, 24 Jan 2022 06:49:50 -0500 (EST) Date: Mon, 24 Jan 2022 06:49:50 -0500 (EST) From: Mathieu Desnoyers To: Linus Torvalds Cc: Thomas Gleixner , linux-kernel , Peter Zijlstra , paulmck , Boqun Feng , "H. Peter Anvin" , Paul Turner , linux-api , stable , Florian Weimer , Andy Lutomirski , Dave Watson , Andrew Morton , Russell King , Andi Kleen , Christian Brauner , Ben Maurer , rostedt , Josh Triplett , Catalin Marinas , Will Deacon , Michael Kerrisk , Joel Fernandes Message-ID: <1704063895.68277.1643024990042.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20220123193154.14565-1-mathieu.desnoyers@efficios.com> Subject: Re: [RFC PATCH] rseq: Fix broken uapi field layout on 32-bit little endian MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_4180 (ZimbraWebClient - FF96 (Linux)/8.8.15_GA_4177) Thread-Topic: rseq: Fix broken uapi field layout on 32-bit little endian Thread-Index: 91NRQaoYbR37CijZG/AtbbyrNK/roA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Jan 24, 2022, at 2:42 AM, Linus Torvalds torvalds@linux-foundation.org wrote: > On Sun, Jan 23, 2022 at 9:32 PM Mathieu Desnoyers > wrote: >> >> 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. > > Please don't double down on something that was already broken once. > > Just remove the broken 32-bit one entirely that the kernel doesn't > even use, and make everybody use > > __u64 ptr64; > > and be done with it. OK, should I just leave: struct rseq { [...] union rseq_cs { __u64 ptr64; } rseq_cs; [...] }; and remove all the other content from the union, so users of rseq_abi->rseq_cs.ptr64 will continue to work as-is with either old and new headers ? This keeps a union in place with a single element, so I just want to confirm with you that is what you have in mind. It does make tons of sense to just remove the broken convenience code and let user-space handle this based on the ptr64 field, so it will work fine with old and new headers. Thanks for your feedback, and travel safe! Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com