[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <122741024.71528.1588019257574.JavaMail.zimbra@efficios.com>
Date: Mon, 27 Apr 2020 16:27:37 -0400 (EDT)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Florian Weimer <fw@...eb.enyo.de>
Cc: Michael Kerrisk <mtk.manpages@...il.com>,
libc-alpha <libc-alpha@...rceware.org>,
Carlos O'Donell <carlos@...hat.com>,
Rich Felker <dalias@...c.org>,
linux-api <linux-api@...r.kernel.org>,
Boqun Feng <boqun.feng@...il.com>,
Will Deacon <will.deacon@....com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ben Maurer <bmaurer@...com>, Dave Watson <davejwatson@...com>,
Thomas Gleixner <tglx@...utronix.de>,
Paul <paulmck@...ux.vnet.ibm.com>, Paul Turner <pjt@...gle.com>,
Joseph Myers <joseph@...esourcery.com>,
Szabolcs Nagy <szabolcs.nagy@....com>
Subject: Re: [PATCH glibc 5/9] glibc: Perform rseq(2) registration at C
startup and thread creation (v17)
----- On Apr 27, 2020, at 1:26 PM, Mathieu Desnoyers mathieu.desnoyers@...icios.com wrote:
[...]
>>> We don't mind that user-space uses that pointer, but we never want the kernel
>>> to touch that pointer rather than the 32/64-bit-aware fields. One possibility
>>> would be to do:
>>>
>>> union
>>> {
>>> uint64_t ptr64;
>>> #ifdef __LP64__
>>> uint64_t ptr;
>>> #else
>>> struct
>>> {
>>> #if (defined (__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined
>>> (__BIG_ENDIAN)
>>> uint32_t padding; /* Initialized to zero. */
>>> uint32_t ptr32;
>>> #else /* LITTLE */
>>> uint32_t ptr32;
>>> uint32_t padding; /* Initialized to zero. */
>>> #endif /* ENDIAN */
>>> } ptr;
>>> #endif
>>>
>>> #ifndef __KERNEL__
>>> const struct rseq_cs *uptr;
>>> #endif
>>> } rseq_cs;
>>>
>>> in the union, so only user-space can see that field. Thoughts ?
>>
>> I think this depends on where the x32 question lands.
>
> x32 should not be an issue as explained above, so I'm very open to
> add this "uptr" for user-space only.
Actually, the snippet above is broken on 32-bit. It needs to be:
union
{
uint64_t ptr64;
#ifdef __LP64__
uint64_t ptr;
# ifndef __KERNEL__
const struct rseq_cs *uptr;
# endif
#else
struct
{
#if (defined (__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined (__BIG_ENDIAN)
uint32_t padding; /* Initialized to zero. */
uint32_t ptr32;
#else /* LITTLE */
uint32_t ptr32;
uint32_t padding; /* Initialized to zero. */
#endif /* ENDIAN */
} ptr;
# ifndef __KERNEL__
struct
{
# if (defined (__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined (__BIG_ENDIAN)
uint32_t padding; /* Initialized to zero. */
const struct rseq_cs *uptr32;
# else /* LITTLE */
const struct rseq_cs *uptr32;
uint32_t padding; /* Initialized to zero. */
# endif /* ENDIAN */
} uptr;
# endif
#endif
} rseq_cs;
I'll leave this out of the patchset for now as we'd need more feedback on its
usefulness.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Powered by blists - more mailing lists