mirror of
git://sourceware.org/git/glibc.git
synced 2025-02-05 12:40:55 +08:00
nptl: Unconditionally use a 32-byte rseq area
If the kernel headers provide a larger struct rseq, we used that size as the argument to the rseq system call. As a result, rseq registration would fail on older kernels which only accept size 32.
This commit is contained in:
parent
f7f181c12c
commit
2c6b4b272e
18
nptl/descr.h
18
nptl/descr.h
@ -34,7 +34,6 @@
|
|||||||
#include <bits/types/res_state.h>
|
#include <bits/types/res_state.h>
|
||||||
#include <kernel-features.h>
|
#include <kernel-features.h>
|
||||||
#include <tls-internal-struct.h>
|
#include <tls-internal-struct.h>
|
||||||
#include <sys/rseq.h>
|
|
||||||
#include <internal-sigset.h>
|
#include <internal-sigset.h>
|
||||||
|
|
||||||
#ifndef TCB_ALIGNMENT
|
#ifndef TCB_ALIGNMENT
|
||||||
@ -405,14 +404,25 @@ struct pthread
|
|||||||
/* Used on strsignal. */
|
/* Used on strsignal. */
|
||||||
struct tls_internal_t tls_state;
|
struct tls_internal_t tls_state;
|
||||||
|
|
||||||
/* rseq area registered with the kernel. */
|
/* rseq area registered with the kernel. Use a custom definition
|
||||||
struct rseq rseq_area;
|
here to isolate from kernel struct rseq changes. The
|
||||||
|
implementation of sched_getcpu needs acccess to the cpu_id field;
|
||||||
|
the other fields are unused and not included here. */
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32_t cpu_id_start;
|
||||||
|
uint32_t cpu_id;
|
||||||
|
};
|
||||||
|
char pad[32]; /* Original rseq area size. */
|
||||||
|
} rseq_area __attribute__ ((aligned (32)));
|
||||||
|
|
||||||
/* Amount of end padding, if any, in this structure.
|
/* Amount of end padding, if any, in this structure.
|
||||||
This definition relies on rseq_area being last. */
|
This definition relies on rseq_area being last. */
|
||||||
#define PTHREAD_STRUCT_END_PADDING \
|
#define PTHREAD_STRUCT_END_PADDING \
|
||||||
(sizeof (struct pthread) - offsetof (struct pthread, rseq_area) \
|
(sizeof (struct pthread) - offsetof (struct pthread, rseq_area) \
|
||||||
+ sizeof (struct rseq))
|
+ sizeof ((struct pthread) {}.rseq_area))
|
||||||
} __attribute ((aligned (TCB_ALIGNMENT)));
|
} __attribute ((aligned (TCB_ALIGNMENT)));
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
|
Loading…
Reference in New Issue
Block a user