lkml.org 
[lkml]   [2020]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@efficios.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

\
 
 \ /
  Last update: 2020-03-20 15:48    [W:0.055 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site