From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Christian Brauner <brauner@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
linux-kernel <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
paulmck <paulmck@kernel.org>, Boqun Feng <boqun.feng@gmail.com>,
"H. Peter Anvin" <hpa@zytor.com>, Paul Turner <pjt@google.com>,
linux-api <linux-api@vger.kernel.org>, shuah <shuah@kernel.org>,
linux-kselftest <linux-kselftest@vger.kernel.org>,
Florian Weimer <fw@deneb.enyo.de>,
Andy Lutomirski <luto@amacapital.net>,
Dave Watson <davejwatson@fb.com>,
Andrew Morton <akpm@linux-foundation.org>,
Russell King <linux@arm.linux.org.uk>,
Andi Kleen <andi@firstfloor.org>,
Christian Brauner <christian.brauner@ubuntu.com>,
Ben Maurer <bmaurer@fb.com>, rostedt <rostedt@goodmis.org>,
Josh Triplett <josh@joshtriplett.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Michael Kerrisk <mtk.manpages@gmail.com>,
Joel Fernandes <joelaf@google.com>
Subject: Re: [RFC PATCH 02/15] rseq: Remove broken uapi field layout on 32-bit little endian
Date: Tue, 25 Jan 2022 09:41:13 -0500 (EST) [thread overview]
Message-ID: <1234069751.70438.1643121673355.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <20220125122156.v2f5anzcs35i3rii@wittgenstein>
----- On Jan 25, 2022, at 7:21 AM, Christian Brauner brauner@kernel.org wrote:
> On Mon, Jan 24, 2022 at 12:12:40PM -0500, 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.
>>
>> 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 <mathieu.desnoyers@efficios.com>
>> Cc: Florian Weimer <fw@deneb.enyo.de>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: linux-api@vger.kernel.org
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: Boqun Feng <boqun.feng@gmail.com>
>> Cc: Andy Lutomirski <luto@amacapital.net>
>> Cc: Dave Watson <davejwatson@fb.com>
>> Cc: Paul Turner <pjt@google.com>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Russell King <linux@arm.linux.org.uk>
>> Cc: "H . Peter Anvin" <hpa@zytor.com>
>> Cc: Andi Kleen <andi@firstfloor.org>
>> Cc: Christian Brauner <christian.brauner@ubuntu.com>
>> Cc: Ben Maurer <bmaurer@fb.com>
>> Cc: Steven Rostedt <rostedt@goodmis.org>
>> Cc: Josh Triplett <josh@joshtriplett.org>
>> Cc: Linus Torvalds <torvalds@linux-foundation.org>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will.deacon@arm.com>
>> Cc: Michael Kerrisk <mtk.manpages@gmail.com>
>> Cc: Joel Fernandes <joelaf@google.com>
>> Cc: Paul E. McKenney <paulmck@kernel.org>
>> ---
>> 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 {
>
> 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 ?
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2022-01-25 14:45 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-24 17:12 [RFC PATCH 00/15] rseq uapi and selftest updates Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 01/15] selftests/rseq: introduce own copy of rseq uapi header Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 02/15] rseq: Remove broken uapi field layout on 32-bit little endian Mathieu Desnoyers
2022-01-25 12:21 ` Christian Brauner
2022-01-25 14:41 ` Mathieu Desnoyers [this message]
2022-01-25 19:00 ` Mathieu Desnoyers
2022-01-26 8:03 ` Christian Brauner
2022-01-26 11:00 ` Florian Weimer
2022-01-26 17:16 ` David Laight
2022-01-26 18:59 ` Mathieu Desnoyers
2022-01-27 15:27 ` [RFC PATCH v2] " Mathieu Desnoyers
2022-01-28 8:52 ` Christian Brauner
2022-01-24 17:12 ` [RFC PATCH 03/15] selftests/rseq: Remove useless assignment to cpu variable Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 04/15] selftests/rseq: Remove volatile from __rseq_abi Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 05/15] selftests/rseq: Introduce rseq_get_abi() helper Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 06/15] selftests/rseq: Introduce thread pointer getters Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 07/15] selftests/rseq: Uplift rseq selftests for compatibility with glibc-2.35 Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 08/15] selftests/rseq: Fix ppc32: wrong rseq_cs 32-bit field pointer on big endian Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 09/15] selftests/rseq: Fix ppc32 missing instruction selection "u" and "x" for load/store Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 10/15] selftests/rseq: Fix ppc32 offsets by using long rather than off_t Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 11/15] selftests/rseq: Fix warnings about #if checks of undefined tokens Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 12/15] selftests/rseq: Remove arm/mips asm goto compiler work-around Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 13/15] selftests/rseq: Fix: work-around asm goto compiler bugs Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 14/15] selftests/rseq: x86-64: use %fs segment selector for accessing rseq thread area Mathieu Desnoyers
2022-01-24 17:12 ` [RFC PATCH 15/15] selftests/rseq: x86-32: use %gs " Mathieu Desnoyers
2022-01-27 15:46 ` [RFC PATCH 00/15] rseq uapi and selftest updates Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1234069751.70438.1643121673355.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=bmaurer@fb.com \
--cc=boqun.feng@gmail.com \
--cc=brauner@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=christian.brauner@ubuntu.com \
--cc=davejwatson@fb.com \
--cc=fw@deneb.enyo.de \
--cc=hpa@zytor.com \
--cc=joelaf@google.com \
--cc=josh@joshtriplett.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=luto@amacapital.net \
--cc=mtk.manpages@gmail.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox