[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <82259847.4696.1584715631625.JavaMail.zimbra@efficios.com>
Date: Fri, 20 Mar 2020 10:47:11 -0400 (EDT)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Florian Weimer <fw@...eb.enyo.de>
Cc: libc-alpha <libc-alpha@...rceware.org>, carlos <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>,
Thomas Gleixner <tglx@...utronix.de>,
Paul <paulmck@...ux.vnet.ibm.com>, Paul Turner <pjt@...gle.com>,
Joseph Myers <joseph@...esourcery.com>
Subject: Re: [RFC PATCH glibc 4/8] glibc: Perform rseq(2) registration at C
startup and thread creation (v15)
----- On Mar 20, 2020, at 9:44 AM, Mathieu Desnoyers mathieu.desnoyers@...icios.com wrote:
[...]
> Actually, here is an important clarification: the Linux kernel validates
> the struct rseq alignment on registration:
>
> if (!IS_ALIGNED((unsigned long)rseq, __alignof__(*rseq)) ||
> rseq_len != sizeof(*rseq))
> return -EINVAL;
>
> So removing the aligned attribute from struct rseq is actually an
> ABI-breaking change, because it would be incompatible with older
> kernels which perform the IS_ALIGNED check expecting at least at
> 32 bytes alignment.
So I plan to add the following to glibc's sys/rseq.h:
#include <sys/cdefs.h>
[...]
/* Ensure the compiler supports __attribute__ ((aligned)). */
_Static_assert (__alignof__ (struct rseq_cs) >= 4 * sizeof(uint64_t),
"alignment");
_Static_assert (__alignof__ (struct rseq) >= 4 * sizeof(uint64_t),
"alignment");
/* Allocations of struct rseq and struct rseq_cs on the heap need to
be aligned on 32 bytes. Therefore, use of malloc is discouraged
because it does not guarantee alignment. posix_memalign should be
used instead. */
Does it help mitigating your concerns ?
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Powered by blists - more mailing lists