From: David Laight <David.Laight@ACULAB.COM>
To: 'Mathieu Desnoyers' <mathieu.desnoyers@efficios.com>,
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: Wed, 26 Jan 2022 17:16:16 +0000 [thread overview]
Message-ID: <fc04219fc3414bbb968adb844052ecb7@AcuMS.aculab.com> (raw)
In-Reply-To: <1445357149.71067.1643137248305.JavaMail.zimbra@efficios.com>
From: Mathieu Desnoyers
> Sent: 25 January 2022 19:01
>
> ----- 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.
But:
v.rseq_cs.ptr_64 = (uintptr_t)&foo;
is broken.
> Based on this, I am inclined to remove the union, and just make the rseq_cs field
> a __u64.
It really is a shame that you can't do:
void *rseq_cs __attribute__((size(8)));
and have the compiler just DTRT on 32bit systems.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2022-01-26 17:16 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
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 [this message]
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=fc04219fc3414bbb968adb844052ecb7@AcuMS.aculab.com \
--to=david.laight@aculab.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=mathieu.desnoyers@efficios.com \
--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