mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 20:40:05 +00:00
Linux: Remove rseq support
The kernel ABI is not finalized, and there are now various proposals to change the size of struct rseq, which would make the glibc ABI dependent on the version of the kernels used for building glibc. This is of course not acceptable. This reverts commit48699da1c4
("elf: Support at least 32-byte alignment in static dlopen"), commit8f4632deb3
("Linux: rseq registration tests"), commit6e29cb3f61
("Linux: Use rseq in sched_getcpu if available"), and commit0c76fc3c2b
("Linux: Perform rseq registration at C startup and thread creation"), resolving the conflicts introduced by the ARC port and the TLS static surplus changes. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
parent
da7d62b503
commit
efedd1ed3d
10
NEWS
10
NEWS
@ -42,16 +42,6 @@ Major new features:
|
||||
pthread_attr_getsigmask_np have been added. They allow applications
|
||||
to specify the signal mask of a thread created with pthread_create.
|
||||
|
||||
* Support for automatically registering threads with the Linux rseq
|
||||
system call has been added. This system call is implemented starting
|
||||
from Linux 4.18. The Restartable Sequences ABI accelerates user-space
|
||||
operations on per-cpu data. It allows user-space to perform updates
|
||||
on per-cpu data without requiring heavy-weight atomic operations.
|
||||
Automatically registering threads allows all libraries, including libc,
|
||||
to make immediate use of the rseq support by using the documented ABI.
|
||||
The GNU C Library manual has details on integration of Restartable
|
||||
Sequences.
|
||||
|
||||
* The GNU C Library now provides the header file <sys/single_threaded.h>
|
||||
which declares the variable __libc_single_threaded. Applications are
|
||||
encouraged to use this variable for single-thread optimizations,
|
||||
|
@ -112,12 +112,6 @@ __libc_setup_tls (void)
|
||||
size_t tcb_offset;
|
||||
const ElfW(Phdr) *phdr;
|
||||
|
||||
/* libc.so with rseq has TLS with 32-byte alignment. Static dlopen
|
||||
requires at least 32-byte alignment as well, otherwise loading
|
||||
libc.so will always fail. */
|
||||
if (max_align < 32)
|
||||
max_align = 32;
|
||||
|
||||
struct link_map *main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
|
||||
|
||||
/* Look through the TLS segment if there is any. */
|
||||
|
@ -55,7 +55,7 @@
|
||||
but come on top when computing the number of namespaces. */
|
||||
|
||||
/* Size of initial-exec TLS in libc.so. */
|
||||
#define LIBC_IE_TLS 192
|
||||
#define LIBC_IE_TLS 160
|
||||
/* Size of initial-exec TLS in libraries other than libc.so.
|
||||
This should be large enough to cover runtime libraries of the
|
||||
compiler such as libgomp and libraries in libc other than libc.so. */
|
||||
@ -190,12 +190,6 @@ void
|
||||
_dl_determine_tlsoffset (void)
|
||||
{
|
||||
size_t max_align = TLS_TCB_ALIGN;
|
||||
/* libc.so with rseq has TLS with 32-byte alignment. Since TLS is
|
||||
initialized before audit modules are loaded and slotinfo
|
||||
information is available, this is not taken into account below in
|
||||
the audit case. */
|
||||
max_align = MAX (max_align, 32U);
|
||||
|
||||
size_t freetop = 0;
|
||||
size_t freebottom = 0;
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <libc-early-init.h>
|
||||
#include <rseq-internal.h>
|
||||
#include <sys/single_threaded.h>
|
||||
|
||||
void
|
||||
@ -27,10 +26,6 @@ __libc_early_init (_Bool initial)
|
||||
/* Initialize ctype data. */
|
||||
__ctype_init ();
|
||||
|
||||
/* Register rseq ABI to the kernel for the main program's libc. */
|
||||
if (initial)
|
||||
rseq_register_current_thread ();
|
||||
|
||||
/* Only the outer namespace is marked as single-threaded. */
|
||||
__libc_single_threaded = initial;
|
||||
}
|
||||
|
@ -629,8 +629,6 @@ the standard.
|
||||
* Waiting with Explicit Clocks:: Functions for waiting with an
|
||||
explicit clock specification.
|
||||
* Single-Threaded:: Detecting single-threaded execution.
|
||||
* Restartable Sequences:: Linux-specific Restartable Sequences
|
||||
integration.
|
||||
@end menu
|
||||
|
||||
@node Default Thread Attributes
|
||||
@ -958,68 +956,6 @@ application-created thread because future versions of @theglibc{} may
|
||||
create background threads after the first thread has been created, and
|
||||
the application has no way of knowning that these threads are present.
|
||||
|
||||
@node Restartable Sequences
|
||||
@subsubsection Restartable Sequences
|
||||
|
||||
This section describes Restartable Sequences integration for
|
||||
@theglibc{}. This functionality is only available on Linux.
|
||||
|
||||
@deftypevar {struct rseq} __rseq_abi
|
||||
@standards{Linux, sys/rseq.h}
|
||||
@Theglibc{} implements a @code{__rseq_abi} TLS symbol to interact with
|
||||
the Restartable Sequences system call. The layout of this structure is
|
||||
defined by the @file{sys/rseq.h} header. Registration of each thread's
|
||||
@code{__rseq_abi} is performed by @theglibc{} at library initialization
|
||||
and thread creation. The manual for the rseq system call can be found
|
||||
at @uref{https://git.kernel.org/pub/scm/libs/librseq/librseq.git/tree/doc/man/rseq.2}.
|
||||
|
||||
The main executable and shared libraries may either have an undefined
|
||||
@code{__rseq_abi} TLS symbol, or define their own, with the same
|
||||
declaration as the one present in @file{sys/rseq.h}. The dynamic linker
|
||||
will ensure that only one of those available symbols will be used at
|
||||
runtime across the process.
|
||||
|
||||
If the main executable or shared libraries observe an uninitialized
|
||||
@code{__rseq_abi.cpu_id} field (value @code{RSEQ_CPU_ID_UNINITIALIZED}),
|
||||
they may perform rseq registration to the kernel: this means either
|
||||
glibc was prevented from doing the registration, or an older glibc
|
||||
version, which does not include rseq support, is in use. When the main
|
||||
executable or a library thus takes ownership of the registration, the
|
||||
memory used to hold the @code{__rseq_abi} TLS variable must stay
|
||||
allocated, and is not re-used, until the very end of the thread lifetime
|
||||
or until an explicit rseq unregistration for that thread is performed.
|
||||
It is not recommended to @code{dlclose} libraries owning the
|
||||
@code{__rseq_abi} TLS variable.
|
||||
|
||||
Users of the @code{__rseq_abi} TLS symbol can store the address of a
|
||||
@code{struct rseq_cs} to the @code{__rseq_abi.rseq_cs} TLS variable,
|
||||
thus informing the kernel that it enters a Restartable Sequence critical
|
||||
section. This pointer and the code areas it itself points to must not
|
||||
be left pointing to memory areas which are freed or re-used. Several
|
||||
approaches can guarantee this. If the application or library can
|
||||
guarantee that the memory used to hold the @code{struct rseq_cs} and the
|
||||
code areas it refers to are never freed or re-used, no special action
|
||||
must be taken. Else, before that memory is re-used of freed, the
|
||||
application is responsible for setting the @code{__rseq_abi.rseq_cs} TLS
|
||||
variable to @code{NULL} in each thread's TLS to guarantee that it does
|
||||
not leak dangling references. Because the application does not
|
||||
typically have knowledge of libraries' use of Restartable Sequences, it
|
||||
is recommended that libraries using Restartable Sequences which may end
|
||||
up freeing or re-using their memory set the @code{__rseq_abi.rseq_cs}
|
||||
TLS variable to @code{NULL} before returning from library functions
|
||||
which use Restartable Sequences.
|
||||
|
||||
@end deftypevar
|
||||
|
||||
@deftypevr Macro int RSEQ_SIG
|
||||
@standards{Linux, sys/rseq.h}
|
||||
Each supported architecture provides a @code{RSEQ_SIG} macro in
|
||||
@file{sys/rseq.h} which contains a signature. That signature is
|
||||
expected to be present in the code before each Restartable Sequences
|
||||
abort handler. Failure to provide the expected signature may terminate
|
||||
the process with a segmentation fault.
|
||||
@end deftypevr
|
||||
|
||||
@c FIXME these are undocumented:
|
||||
@c pthread_atfork
|
||||
@c pthread_attr_destroy
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <default-sched.h>
|
||||
#include <futex-internal.h>
|
||||
#include <tls-setup.h>
|
||||
#include <rseq-internal.h>
|
||||
#include "libioP.h"
|
||||
#include <sys/single_threaded.h>
|
||||
|
||||
@ -386,9 +385,6 @@ START_THREAD_DEFN
|
||||
/* Initialize pointers to locale data. */
|
||||
__ctype_init ();
|
||||
|
||||
/* Register rseq TLS to the kernel. */
|
||||
rseq_register_current_thread ();
|
||||
|
||||
#ifndef __ASSUME_SET_ROBUST_LIST
|
||||
if (__set_robust_list_avail >= 0)
|
||||
#endif
|
||||
@ -585,15 +581,6 @@ START_THREAD_DEFN
|
||||
process is really dead since 'clone' got passed the CLONE_CHILD_CLEARTID
|
||||
flag. The 'tid' field in the TCB will be set to zero.
|
||||
|
||||
rseq TLS is still registered at this point. Rely on implicit
|
||||
unregistration performed by the kernel on thread teardown. This is not a
|
||||
problem because the rseq TLS lives on the stack, and the stack outlives
|
||||
the thread. If TCB allocation is ever changed, additional steps may be
|
||||
required, such as performing explicit rseq unregistration before
|
||||
reclaiming the rseq TLS area memory. It is NOT sufficient to block
|
||||
signals because the kernel may write to the rseq area even without
|
||||
signals.
|
||||
|
||||
The exit code is zero since in case all threads exit by calling
|
||||
'pthread_exit' the exit status must be 0 (zero). */
|
||||
__exit_thread ();
|
||||
|
@ -1,26 +0,0 @@
|
||||
/* Restartable Sequences internal API. Stub version.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef RSEQ_INTERNAL_H
|
||||
#define RSEQ_INTERNAL_H
|
||||
|
||||
static inline void
|
||||
rseq_register_current_thread (void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* rseq-internal.h */
|
@ -41,7 +41,7 @@ update-syscall-lists: arch-syscall.h
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),csu)
|
||||
sysdep_routines += errno-loc rseq-sym
|
||||
sysdep_routines += errno-loc
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),assert)
|
||||
@ -94,19 +94,14 @@ sysdep_headers += sys/mount.h sys/acct.h \
|
||||
bits/types/struct_semid_ds.h \
|
||||
bits/types/struct_msqid_ds.h \
|
||||
bits/types/struct_shmid_ds.h \
|
||||
bits/ipc-perm.h \
|
||||
sys/rseq.h bits/rseq.h
|
||||
bits/ipc-perm.h
|
||||
|
||||
tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
|
||||
tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
|
||||
test-errno-linux tst-memfd_create tst-mlock2 tst-pkey \
|
||||
tst-rlimit-infinity tst-ofdlocks tst-gettid tst-gettid-kill \
|
||||
tst-tgkill
|
||||
|
||||
# tst-rseq is an internal test because it requires a definition of __NR_rseq
|
||||
# from the internal system call list.
|
||||
tests-internal += tst-ofdlocks-compat tst-sigcontext-get_pc \
|
||||
tst-rseq
|
||||
tests-internal += tst-ofdlocks-compat tst-sigcontext-get_pc
|
||||
|
||||
CFLAGS-tst-sigcontext-get_pc.c = -fasynchronous-unwind-tables
|
||||
|
||||
@ -307,8 +302,4 @@ endif
|
||||
|
||||
ifeq ($(subdir),nptl)
|
||||
tests += tst-align-clone tst-getpid1
|
||||
|
||||
# tst-rseq-nptl is an internal test because it requires a definition of
|
||||
# __NR_rseq from the internal system call list.
|
||||
tests-internal += tst-rseq-nptl
|
||||
endif
|
||||
|
@ -168,7 +168,6 @@ libc {
|
||||
getdents64; gettid; tgkill;
|
||||
}
|
||||
GLIBC_2.32 {
|
||||
__rseq_abi;
|
||||
}
|
||||
GLIBC_PRIVATE {
|
||||
# functions used in other libraries
|
||||
|
@ -1,43 +0,0 @@
|
||||
/* Restartable Sequences Linux aarch64 architecture header.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SYS_RSEQ_H
|
||||
# error "Never use <bits/rseq.h> directly; include <sys/rseq.h> instead."
|
||||
#endif
|
||||
|
||||
/* RSEQ_SIG is a signature required before each abort handler code.
|
||||
|
||||
It is a 32-bit value that maps to actual architecture code compiled
|
||||
into applications and libraries. It needs to be defined for each
|
||||
architecture. When choosing this value, it needs to be taken into
|
||||
account that generating invalid instructions may have ill effects on
|
||||
tools like objdump, and may also have impact on the CPU speculative
|
||||
execution efficiency in some cases.
|
||||
|
||||
aarch64 -mbig-endian generates mixed endianness code vs data:
|
||||
little-endian code and big-endian data. Ensure the RSEQ_SIG signature
|
||||
matches code endianness. */
|
||||
|
||||
#define RSEQ_SIG_CODE 0xd428bc00 /* BRK #0x45E0. */
|
||||
|
||||
#ifdef __AARCH64EB__
|
||||
# define RSEQ_SIG_DATA 0x00bc28d4 /* BRK #0x45E0. */
|
||||
#else
|
||||
# define RSEQ_SIG_DATA RSEQ_SIG_CODE
|
||||
#endif
|
||||
|
||||
#define RSEQ_SIG RSEQ_SIG_DATA
|
@ -2150,7 +2150,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2232,7 +2232,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -345,7 +345,6 @@ GLIBC_2.32 __res_nclose F
|
||||
GLIBC_2.32 __res_ninit F
|
||||
GLIBC_2.32 __res_randomid F
|
||||
GLIBC_2.32 __res_state F
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 __sbrk F
|
||||
GLIBC_2.32 __sched_cpualloc F
|
||||
GLIBC_2.32 __sched_cpucount F
|
||||
|
@ -134,7 +134,6 @@ GLIBC_2.31 msgctl F
|
||||
GLIBC_2.31 semctl F
|
||||
GLIBC_2.31 shmctl F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -1,83 +0,0 @@
|
||||
/* Restartable Sequences Linux arm architecture header.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SYS_RSEQ_H
|
||||
# error "Never use <bits/rseq.h> directly; include <sys/rseq.h> instead."
|
||||
#endif
|
||||
|
||||
/*
|
||||
RSEQ_SIG is a signature required before each abort handler code.
|
||||
|
||||
It is a 32-bit value that maps to actual architecture code compiled
|
||||
into applications and libraries. It needs to be defined for each
|
||||
architecture. When choosing this value, it needs to be taken into
|
||||
account that generating invalid instructions may have ill effects on
|
||||
tools like objdump, and may also have impact on the CPU speculative
|
||||
execution efficiency in some cases.
|
||||
|
||||
- ARM little endian
|
||||
|
||||
RSEQ_SIG uses the udf A32 instruction with an uncommon immediate operand
|
||||
value 0x5de3. This traps if user-space reaches this instruction by mistake,
|
||||
and the uncommon operand ensures the kernel does not move the instruction
|
||||
pointer to attacker-controlled code on rseq abort.
|
||||
|
||||
The instruction pattern in the A32 instruction set is:
|
||||
|
||||
e7f5def3 udf #24035 ; 0x5de3
|
||||
|
||||
This translates to the following instruction pattern in the T16 instruction
|
||||
set:
|
||||
|
||||
little endian:
|
||||
def3 udf #243 ; 0xf3
|
||||
e7f5 b.n <7f5>
|
||||
|
||||
- ARMv6+ big endian (BE8):
|
||||
|
||||
ARMv6+ -mbig-endian generates mixed endianness code vs data: little-endian
|
||||
code and big-endian data. The data value of the signature needs to have its
|
||||
byte order reversed to generate the trap instruction:
|
||||
|
||||
Data: 0xf3def5e7
|
||||
|
||||
Translates to this A32 instruction pattern:
|
||||
|
||||
e7f5def3 udf #24035 ; 0x5de3
|
||||
|
||||
Translates to this T16 instruction pattern:
|
||||
|
||||
def3 udf #243 ; 0xf3
|
||||
e7f5 b.n <7f5>
|
||||
|
||||
- Prior to ARMv6 big endian (BE32):
|
||||
|
||||
Prior to ARMv6, -mbig-endian generates big-endian code and data
|
||||
(which match), so the endianness of the data representation of the
|
||||
signature should not be reversed. However, the choice between BE32
|
||||
and BE8 is done by the linker, so we cannot know whether code and
|
||||
data endianness will be mixed before the linker is invoked. So rather
|
||||
than try to play tricks with the linker, the rseq signature is simply
|
||||
data (not a trap instruction) prior to ARMv6 on big endian. This is
|
||||
why the signature is expressed as data (.word) rather than as
|
||||
instruction (.inst) in assembler. */
|
||||
|
||||
#ifdef __ARMEB__
|
||||
# define RSEQ_SIG 0xf3def5e7 /* udf #24035 ; 0x5de3 (ARMv6+) */
|
||||
#else
|
||||
# define RSEQ_SIG 0xe7f5def3 /* udf #24035 ; 0x5de3 */
|
||||
#endif
|
@ -131,7 +131,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -1,29 +0,0 @@
|
||||
/* Restartable Sequences architecture header. Stub version.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SYS_RSEQ_H
|
||||
# error "Never use <bits/rseq.h> directly; include <sys/rseq.h> instead."
|
||||
#endif
|
||||
|
||||
/* RSEQ_SIG is a signature required before each abort handler code.
|
||||
|
||||
It is a 32-bit value that maps to actual architecture code compiled
|
||||
into applications and libraries. It needs to be defined for each
|
||||
architecture. When choosing this value, it needs to be taken into
|
||||
account that generating invalid instructions may have ill effects on
|
||||
tools like objdump, and may also have impact on the CPU speculative
|
||||
execution efficiency in some cases. */
|
@ -2094,7 +2094,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2053,7 +2053,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2219,7 +2219,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2085,7 +2085,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -135,7 +135,6 @@ GLIBC_2.31 msgctl F
|
||||
GLIBC_2.31 semctl F
|
||||
GLIBC_2.31 shmctl F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2165,7 +2165,6 @@ GLIBC_2.31 msgctl F
|
||||
GLIBC_2.31 semctl F
|
||||
GLIBC_2.31 shmctl F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2145,7 +2145,6 @@ GLIBC_2.31 msgctl F
|
||||
GLIBC_2.31 semctl F
|
||||
GLIBC_2.31 shmctl F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2142,7 +2142,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -1,62 +0,0 @@
|
||||
/* Restartable Sequences Linux mips architecture header.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SYS_RSEQ_H
|
||||
# error "Never use <bits/rseq.h> directly; include <sys/rseq.h> instead."
|
||||
#endif
|
||||
|
||||
/* RSEQ_SIG is a signature required before each abort handler code.
|
||||
|
||||
It is a 32-bit value that maps to actual architecture code compiled
|
||||
into applications and libraries. It needs to be defined for each
|
||||
architecture. When choosing this value, it needs to be taken into
|
||||
account that generating invalid instructions may have ill effects on
|
||||
tools like objdump, and may also have impact on the CPU speculative
|
||||
execution efficiency in some cases.
|
||||
|
||||
RSEQ_SIG uses the break instruction. The instruction pattern is:
|
||||
|
||||
On MIPS:
|
||||
0350000d break 0x350
|
||||
|
||||
On nanoMIPS:
|
||||
00100350 break 0x350
|
||||
|
||||
On microMIPS:
|
||||
0000d407 break 0x350
|
||||
|
||||
For nanoMIPS32 and microMIPS, the instruction stream is encoded as
|
||||
16-bit halfwords, so the signature halfwords need to be swapped
|
||||
accordingly for little-endian. */
|
||||
|
||||
#if defined (__nanomips__)
|
||||
# ifdef __MIPSEL__
|
||||
# define RSEQ_SIG 0x03500010
|
||||
# else
|
||||
# define RSEQ_SIG 0x00100350
|
||||
# endif
|
||||
#elif defined (__mips_micromips)
|
||||
# ifdef __MIPSEL__
|
||||
# define RSEQ_SIG 0xd4070000
|
||||
# else
|
||||
# define RSEQ_SIG 0x0000d407
|
||||
# endif
|
||||
#elif defined (__mips__)
|
||||
# define RSEQ_SIG 0x0350000d
|
||||
#else
|
||||
/* Unknown MIPS architecture. */
|
||||
#endif
|
@ -2136,7 +2136,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2134,7 +2134,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2142,7 +2142,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2136,7 +2136,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2183,7 +2183,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -1,37 +0,0 @@
|
||||
/* Restartable Sequences Linux powerpc architecture header.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SYS_RSEQ_H
|
||||
# error "Never use <bits/rseq.h> directly; include <sys/rseq.h> instead."
|
||||
#endif
|
||||
|
||||
/* RSEQ_SIG is a signature required before each abort handler code.
|
||||
|
||||
It is a 32-bit value that maps to actual architecture code compiled
|
||||
into applications and libraries. It needs to be defined for each
|
||||
architecture. When choosing this value, it needs to be taken into
|
||||
account that generating invalid instructions may have ill effects on
|
||||
tools like objdump, and may also have impact on the CPU speculative
|
||||
execution efficiency in some cases.
|
||||
|
||||
RSEQ_SIG uses the following trap instruction:
|
||||
|
||||
powerpc-be: 0f e5 00 0b twui r5,11
|
||||
powerpc64-le: 0b 00 e5 0f twui r5,11
|
||||
powerpc64-be: 0f e5 00 0b twui r5,11 */
|
||||
|
||||
#define RSEQ_SIG 0x0fe5000b
|
@ -2192,7 +2192,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2225,7 +2225,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2055,7 +2055,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2292,7 +2292,6 @@ GLIBC_2.32 __qecvtieee128_r F
|
||||
GLIBC_2.32 __qfcvtieee128 F
|
||||
GLIBC_2.32 __qfcvtieee128_r F
|
||||
GLIBC_2.32 __qgcvtieee128 F
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 __scanfieee128 F
|
||||
GLIBC_2.32 __snprintf_chkieee128 F
|
||||
GLIBC_2.32 __snprintfieee128 F
|
||||
|
@ -2112,7 +2112,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -1,73 +0,0 @@
|
||||
/* Restartable Sequences internal API. Linux implementation.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef RSEQ_INTERNAL_H
|
||||
#define RSEQ_INTERNAL_H
|
||||
|
||||
#include <sysdep.h>
|
||||
#include <errno.h>
|
||||
#include <kernel-features.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/rseq.h>
|
||||
|
||||
#ifdef RSEQ_SIG
|
||||
static inline void
|
||||
rseq_register_current_thread (void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (__rseq_abi.cpu_id != RSEQ_CPU_ID_UNINITIALIZED)
|
||||
__libc_fatal ("glibc fatal error: "
|
||||
"rseq already initialized for this thread\n");
|
||||
ret = INTERNAL_SYSCALL_CALL (rseq, &__rseq_abi, sizeof (struct rseq),
|
||||
0, RSEQ_SIG);
|
||||
if (INTERNAL_SYSCALL_ERROR_P (ret))
|
||||
{
|
||||
const char *msg = NULL;
|
||||
|
||||
switch (INTERNAL_SYSCALL_ERRNO (ret))
|
||||
{
|
||||
case ENOSYS: /* rseq system call not implemented. */
|
||||
case EPERM: /* rseq system call filtered by seccomp. */
|
||||
case EACCES: /* rseq system call filtered by seccomp. */
|
||||
__rseq_abi.cpu_id = RSEQ_CPU_ID_REGISTRATION_FAILED;
|
||||
break;
|
||||
case EBUSY:
|
||||
msg = "glibc fatal error: rseq already registered for this thread\n";
|
||||
break;
|
||||
case EFAULT:
|
||||
msg = "glibc fatal error: rseq parameter is an invalid address\n";
|
||||
break;
|
||||
case EINVAL:
|
||||
msg = "glibc fatal error: rseq parameters are invalid\n";
|
||||
break;
|
||||
default:
|
||||
msg = "glibc fatal error: unexpected rseq errno\n";
|
||||
break;
|
||||
}
|
||||
if (msg != NULL)
|
||||
__libc_fatal (msg);
|
||||
}
|
||||
}
|
||||
#else /* RSEQ_SIG */
|
||||
static inline void
|
||||
rseq_register_current_thread (void)
|
||||
{
|
||||
}
|
||||
#endif /* RSEQ_SIG */
|
||||
|
||||
#endif /* rseq-internal.h */
|
@ -1,26 +0,0 @@
|
||||
/* Restartable Sequences exported symbols. Linux Implementation.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#include <stdint.h>
|
||||
#include <kernel-features.h>
|
||||
#include <sys/rseq.h>
|
||||
|
||||
__thread struct rseq __rseq_abi =
|
||||
{
|
||||
.cpu_id = RSEQ_CPU_ID_UNINITIALIZED,
|
||||
};
|
@ -1,37 +0,0 @@
|
||||
/* Restartable Sequences Linux s390 architecture header.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SYS_RSEQ_H
|
||||
# error "Never use <bits/rseq.h> directly; include <sys/rseq.h> instead."
|
||||
#endif
|
||||
|
||||
/* RSEQ_SIG is a signature required before each abort handler code.
|
||||
|
||||
It is a 32-bit value that maps to actual architecture code compiled
|
||||
into applications and libraries. It needs to be defined for each
|
||||
architecture. When choosing this value, it needs to be taken into
|
||||
account that generating invalid instructions may have ill effects on
|
||||
tools like objdump, and may also have impact on the CPU speculative
|
||||
execution efficiency in some cases.
|
||||
|
||||
RSEQ_SIG uses the trap4 instruction. As Linux does not make use of the
|
||||
access-register mode nor the linkage stack this instruction will always
|
||||
cause a special-operation exception (the trap-enabled bit in the DUCT
|
||||
is and will stay 0). The instruction pattern is
|
||||
b2 ff 0f ff trap4 4095(%r0) */
|
||||
|
||||
#define RSEQ_SIG 0xB2FF0FFF
|
@ -2190,7 +2190,6 @@ GLIBC_2.31 msgctl F
|
||||
GLIBC_2.31 semctl F
|
||||
GLIBC_2.31 shmctl F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2091,7 +2091,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -18,12 +18,10 @@
|
||||
#include <errno.h>
|
||||
#include <sched.h>
|
||||
#include <sysdep.h>
|
||||
#include <atomic.h>
|
||||
#include <sysdep-vdso.h>
|
||||
#include <sys/rseq.h>
|
||||
|
||||
static int
|
||||
vsyscall_sched_getcpu (void)
|
||||
int
|
||||
sched_getcpu (void)
|
||||
{
|
||||
unsigned int cpu;
|
||||
int r = -1;
|
||||
@ -34,19 +32,3 @@ vsyscall_sched_getcpu (void)
|
||||
#endif
|
||||
return r == -1 ? r : cpu;
|
||||
}
|
||||
|
||||
#ifdef RSEQ_SIG
|
||||
int
|
||||
sched_getcpu (void)
|
||||
{
|
||||
int cpu_id = atomic_load_relaxed (&__rseq_abi.cpu_id);
|
||||
|
||||
return cpu_id >= 0 ? cpu_id : vsyscall_sched_getcpu ();
|
||||
}
|
||||
#else /* RSEQ_SIG */
|
||||
int
|
||||
sched_getcpu (void)
|
||||
{
|
||||
return vsyscall_sched_getcpu ();
|
||||
}
|
||||
#endif /* RSEQ_SIG */
|
||||
|
@ -2060,7 +2060,6 @@ GLIBC_2.31 msgctl F
|
||||
GLIBC_2.31 semctl F
|
||||
GLIBC_2.31 shmctl F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2057,7 +2057,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2181,7 +2181,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2108,7 +2108,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -1,203 +0,0 @@
|
||||
/* Restartable Sequences exported symbols. Linux header.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SYS_RSEQ_H
|
||||
#define _SYS_RSEQ_H 1
|
||||
|
||||
/* Architecture-specific rseq signature. */
|
||||
#include <bits/rseq.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifdef __has_include
|
||||
# if __has_include ("linux/rseq.h")
|
||||
# define __GLIBC_HAVE_KERNEL_RSEQ
|
||||
# endif
|
||||
#else
|
||||
# include <linux/version.h>
|
||||
# if LINUX_VERSION_CODE >= KERNEL_VERSION (4, 18, 0)
|
||||
# define __GLIBC_HAVE_KERNEL_RSEQ
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Rely on GNU extensions for older standards and tls model. */
|
||||
#ifdef __GNUC__
|
||||
# define __rseq_tls_model_ie __attribute__ ((__tls_model__ ("initial-exec")))
|
||||
#else
|
||||
/* Specifying the TLS model on the declaration is optional. */
|
||||
# define __rseq_tls_model_ie /* Nothing. */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
# if __cplusplus >= 201103L
|
||||
# define __rseq_tls_storage_class thread_local
|
||||
# endif
|
||||
#elif (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) >= 201112L
|
||||
# define __rseq_tls_storage_class _Thread_local
|
||||
#endif
|
||||
|
||||
/* Fall back to __thread for TLS storage class. */
|
||||
#ifndef __rseq_tls_storage_class
|
||||
# define __rseq_tls_storage_class __thread
|
||||
#endif
|
||||
|
||||
#ifdef __GLIBC_HAVE_KERNEL_RSEQ
|
||||
/* We use the structures declarations from the kernel headers. */
|
||||
# include <linux/rseq.h>
|
||||
#else /* __GLIBC_HAVE_KERNEL_RSEQ */
|
||||
/* We use a copy of the include/uapi/linux/rseq.h kernel header. */
|
||||
|
||||
# include <asm/byteorder.h>
|
||||
|
||||
enum rseq_cpu_id_state
|
||||
{
|
||||
RSEQ_CPU_ID_UNINITIALIZED = -1,
|
||||
RSEQ_CPU_ID_REGISTRATION_FAILED = -2,
|
||||
};
|
||||
|
||||
enum rseq_flags
|
||||
{
|
||||
RSEQ_FLAG_UNREGISTER = (1 << 0),
|
||||
};
|
||||
|
||||
enum rseq_cs_flags_bit
|
||||
{
|
||||
RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT = 0,
|
||||
RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT = 1,
|
||||
RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT = 2,
|
||||
};
|
||||
|
||||
enum rseq_cs_flags
|
||||
{
|
||||
RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT =
|
||||
(1U << RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT),
|
||||
RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL =
|
||||
(1U << RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT),
|
||||
RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE =
|
||||
(1U << RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT),
|
||||
};
|
||||
|
||||
/* struct rseq_cs is aligned on 32 bytes to ensure it is always
|
||||
contained within a single cache-line. It is usually declared as
|
||||
link-time constant data. */
|
||||
struct rseq_cs
|
||||
{
|
||||
/* Version of this structure. */
|
||||
uint32_t version;
|
||||
/* enum rseq_cs_flags. */
|
||||
uint32_t flags;
|
||||
uint64_t start_ip;
|
||||
/* Offset from start_ip. */
|
||||
uint64_t post_commit_offset;
|
||||
uint64_t abort_ip;
|
||||
} __attribute__ ((__aligned__ (32)));
|
||||
|
||||
/* struct rseq is aligned on 32 bytes to ensure it is always
|
||||
contained within a single cache-line.
|
||||
|
||||
A single struct rseq per thread is allowed. */
|
||||
struct rseq
|
||||
{
|
||||
/* Restartable sequences cpu_id_start field. Updated by the
|
||||
kernel. Read by user-space with single-copy atomicity
|
||||
semantics. This field should only be read by the thread which
|
||||
registered this data structure. Aligned on 32-bit. Always
|
||||
contains a value in the range of possible CPUs, although the
|
||||
value may not be the actual current CPU (e.g. if rseq is not
|
||||
initialized). This CPU number value should always be compared
|
||||
against the value of the cpu_id field before performing a rseq
|
||||
commit or returning a value read from a data structure indexed
|
||||
using the cpu_id_start value. */
|
||||
uint32_t cpu_id_start;
|
||||
/* Restartable sequences cpu_id field. Updated by the kernel.
|
||||
Read by user-space with single-copy atomicity semantics. This
|
||||
field should only be read by the thread which registered this
|
||||
data structure. Aligned on 32-bit. Values
|
||||
RSEQ_CPU_ID_UNINITIALIZED and RSEQ_CPU_ID_REGISTRATION_FAILED
|
||||
have a special semantic: the former means "rseq uninitialized",
|
||||
and latter means "rseq initialization failed". This value is
|
||||
meant to be read within rseq critical sections and compared
|
||||
with the cpu_id_start value previously read, before performing
|
||||
the commit instruction, or read and compared with the
|
||||
cpu_id_start value before returning a value loaded from a data
|
||||
structure indexed using the cpu_id_start value. */
|
||||
uint32_t cpu_id;
|
||||
/* Restartable sequences rseq_cs field.
|
||||
|
||||
Contains NULL when no critical section is active for the current
|
||||
thread, or holds a pointer to the currently active struct rseq_cs.
|
||||
|
||||
Updated by user-space, which sets the address of the currently
|
||||
active rseq_cs at the beginning of assembly instruction sequence
|
||||
block, and set to NULL by the kernel when it restarts an assembly
|
||||
instruction sequence block, as well as when the kernel detects that
|
||||
it is preempting or delivering a signal outside of the range
|
||||
targeted by the rseq_cs. Also needs to be set to NULL by user-space
|
||||
before reclaiming memory that contains the targeted struct rseq_cs.
|
||||
|
||||
Read and set by the kernel. Set by user-space with single-copy
|
||||
atomicity semantics. This field should only be updated by the
|
||||
thread which registered this data structure. Aligned on 64-bit. */
|
||||
union
|
||||
{
|
||||
uint64_t ptr64;
|
||||
# ifdef __LP64__
|
||||
uint64_t ptr;
|
||||
# else /* __LP64__ */
|
||||
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 /* __LP64__ */
|
||||
} rseq_cs;
|
||||
|
||||
/* Restartable sequences flags field.
|
||||
|
||||
This field should only be updated by the thread which
|
||||
registered this data structure. Read by the kernel.
|
||||
Mainly used for single-stepping through rseq critical sections
|
||||
with debuggers.
|
||||
|
||||
- RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT
|
||||
Inhibit instruction sequence block restart on preemption
|
||||
for this thread.
|
||||
- RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL
|
||||
Inhibit instruction sequence block restart on signal
|
||||
delivery for this thread.
|
||||
- RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE
|
||||
Inhibit instruction sequence block restart on migration for
|
||||
this thread. */
|
||||
uint32_t flags;
|
||||
} __attribute__ ((__aligned__ (32)));
|
||||
|
||||
#endif /* __GLIBC_HAVE_KERNEL_RSEQ */
|
||||
|
||||
/* 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. */
|
||||
|
||||
extern __rseq_tls_storage_class struct rseq __rseq_abi __rseq_tls_model_ie;
|
||||
|
||||
#endif /* sys/rseq.h */
|
@ -1,256 +0,0 @@
|
||||
/* Restartable Sequences NPTL test.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* These tests validate that rseq is registered from various execution
|
||||
contexts (main thread, destructor, other threads, other threads created
|
||||
from destructor, forked process (without exec), pthread_atfork handlers,
|
||||
pthread setspecific destructors, signal handlers, atexit handlers).
|
||||
|
||||
See the Linux kernel selftests for extensive rseq stress-tests. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <support/check.h>
|
||||
#include <support/xthread.h>
|
||||
#include <sys/rseq.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef RSEQ_SIG
|
||||
# include <array_length.h>
|
||||
# include <errno.h>
|
||||
# include <error.h>
|
||||
# include <pthread.h>
|
||||
# include <signal.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <support/namespace.h>
|
||||
# include <support/xsignal.h>
|
||||
# include <syscall.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/wait.h>
|
||||
# include "tst-rseq.h"
|
||||
|
||||
static pthread_key_t rseq_test_key;
|
||||
|
||||
static void
|
||||
atfork_prepare (void)
|
||||
{
|
||||
if (!rseq_thread_registered ())
|
||||
{
|
||||
printf ("error: rseq not registered in pthread atfork prepare\n");
|
||||
support_record_failure ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atfork_parent (void)
|
||||
{
|
||||
if (!rseq_thread_registered ())
|
||||
{
|
||||
printf ("error: rseq not registered in pthread atfork parent\n");
|
||||
support_record_failure ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atfork_child (void)
|
||||
{
|
||||
if (!rseq_thread_registered ())
|
||||
{
|
||||
printf ("error: rseq not registered in pthread atfork child\n");
|
||||
support_record_failure ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
rseq_key_destructor (void *arg)
|
||||
{
|
||||
/* Cannot use deferred failure reporting after main returns. */
|
||||
if (!rseq_thread_registered ())
|
||||
FAIL_EXIT1 ("rseq not registered in pthread key destructor");
|
||||
}
|
||||
|
||||
static void
|
||||
atexit_handler (void)
|
||||
{
|
||||
/* Cannot use deferred failure reporting after main returns. */
|
||||
if (!rseq_thread_registered ())
|
||||
FAIL_EXIT1 ("rseq not registered in atexit handler");
|
||||
}
|
||||
|
||||
static void
|
||||
do_rseq_main_test (void)
|
||||
{
|
||||
TEST_COMPARE (atexit (atexit_handler), 0);
|
||||
rseq_test_key = xpthread_key_create (rseq_key_destructor);
|
||||
TEST_COMPARE (pthread_atfork (atfork_prepare, atfork_parent, atfork_child), 0);
|
||||
xraise (SIGUSR1);
|
||||
TEST_COMPARE (pthread_setspecific (rseq_test_key, (void *) 1l), 0);
|
||||
TEST_VERIFY_EXIT (rseq_thread_registered ());
|
||||
}
|
||||
|
||||
static void
|
||||
cancel_routine (void *arg)
|
||||
{
|
||||
if (!rseq_thread_registered ())
|
||||
{
|
||||
printf ("error: rseq not registered in cancel routine\n");
|
||||
support_record_failure ();
|
||||
}
|
||||
}
|
||||
|
||||
static pthread_barrier_t cancel_thread_barrier;
|
||||
static pthread_cond_t cancel_thread_cond = PTHREAD_COND_INITIALIZER;
|
||||
static pthread_mutex_t cancel_thread_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static void
|
||||
test_cancel_thread (void)
|
||||
{
|
||||
pthread_cleanup_push (cancel_routine, NULL);
|
||||
(void) xpthread_barrier_wait (&cancel_thread_barrier);
|
||||
/* Wait forever until cancellation. */
|
||||
xpthread_cond_wait (&cancel_thread_cond, &cancel_thread_mutex);
|
||||
pthread_cleanup_pop (0);
|
||||
}
|
||||
|
||||
static void *
|
||||
thread_function (void * arg)
|
||||
{
|
||||
int i = (int) (intptr_t) arg;
|
||||
|
||||
xraise (SIGUSR1);
|
||||
if (i == 0)
|
||||
test_cancel_thread ();
|
||||
TEST_COMPARE (pthread_setspecific (rseq_test_key, (void *) 1l), 0);
|
||||
return rseq_thread_registered () ? NULL : (void *) 1l;
|
||||
}
|
||||
|
||||
static void
|
||||
sighandler (int sig)
|
||||
{
|
||||
if (!rseq_thread_registered ())
|
||||
{
|
||||
printf ("error: rseq not registered in signal handler\n");
|
||||
support_record_failure ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
setup_signals (void)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
sigemptyset (&sa.sa_mask);
|
||||
sigaddset (&sa.sa_mask, SIGUSR1);
|
||||
sa.sa_flags = 0;
|
||||
sa.sa_handler = sighandler;
|
||||
xsigaction (SIGUSR1, &sa, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
do_rseq_threads_test (int nr_threads)
|
||||
{
|
||||
pthread_t th[nr_threads];
|
||||
int i;
|
||||
int result = 0;
|
||||
|
||||
xpthread_barrier_init (&cancel_thread_barrier, NULL, 2);
|
||||
|
||||
for (i = 0; i < nr_threads; ++i)
|
||||
th[i] = xpthread_create (NULL, thread_function,
|
||||
(void *) (intptr_t) i);
|
||||
|
||||
(void) xpthread_barrier_wait (&cancel_thread_barrier);
|
||||
|
||||
xpthread_cancel (th[0]);
|
||||
|
||||
for (i = 0; i < nr_threads; ++i)
|
||||
{
|
||||
void *v;
|
||||
|
||||
v = xpthread_join (th[i]);
|
||||
if (i != 0 && v != NULL)
|
||||
{
|
||||
printf ("error: join %d successful, but child failed\n", i);
|
||||
result = 1;
|
||||
}
|
||||
else if (i == 0 && v == NULL)
|
||||
{
|
||||
printf ("error: join %d successful, child did not fail as expected\n", i);
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
xpthread_barrier_destroy (&cancel_thread_barrier);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
subprocess_callback (void *closure)
|
||||
{
|
||||
do_rseq_main_test ();
|
||||
}
|
||||
|
||||
static void
|
||||
do_rseq_fork_test (void)
|
||||
{
|
||||
support_isolate_in_subprocess (subprocess_callback, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
do_rseq_test (void)
|
||||
{
|
||||
int t[] = { 1, 2, 6, 5, 4, 3, 50 };
|
||||
int i, result = 0;
|
||||
|
||||
if (!rseq_available ())
|
||||
FAIL_UNSUPPORTED ("kernel does not support rseq, skipping test");
|
||||
setup_signals ();
|
||||
xraise (SIGUSR1);
|
||||
do_rseq_main_test ();
|
||||
for (i = 0; i < array_length (t); i++)
|
||||
if (do_rseq_threads_test (t[i]))
|
||||
result = 1;
|
||||
do_rseq_fork_test ();
|
||||
return result;
|
||||
}
|
||||
|
||||
static void __attribute__ ((destructor))
|
||||
do_rseq_destructor_test (void)
|
||||
{
|
||||
/* Cannot use deferred failure reporting after main returns. */
|
||||
if (do_rseq_test ())
|
||||
FAIL_EXIT1 ("rseq not registered within destructor");
|
||||
xpthread_key_delete (rseq_test_key);
|
||||
}
|
||||
|
||||
#else /* RSEQ_SIG */
|
||||
static int
|
||||
do_rseq_test (void)
|
||||
{
|
||||
FAIL_UNSUPPORTED ("glibc does not define RSEQ_SIG, skipping test");
|
||||
return 0;
|
||||
}
|
||||
#endif /* RSEQ_SIG */
|
||||
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
return do_rseq_test ();
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
@ -1,64 +0,0 @@
|
||||
/* Restartable Sequences single-threaded tests.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* These tests validate that rseq is registered from main in an executable
|
||||
not linked against libpthread. */
|
||||
|
||||
#include <support/check.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/rseq.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef RSEQ_SIG
|
||||
# include <errno.h>
|
||||
# include <error.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <syscall.h>
|
||||
# include "tst-rseq.h"
|
||||
|
||||
static void
|
||||
do_rseq_main_test (void)
|
||||
{
|
||||
TEST_VERIFY_EXIT (rseq_thread_registered ());
|
||||
}
|
||||
|
||||
static void
|
||||
do_rseq_test (void)
|
||||
{
|
||||
if (!rseq_available ())
|
||||
{
|
||||
FAIL_UNSUPPORTED ("kernel does not support rseq, skipping test");
|
||||
}
|
||||
do_rseq_main_test ();
|
||||
}
|
||||
#else /* RSEQ_SIG */
|
||||
static void
|
||||
do_rseq_test (void)
|
||||
{
|
||||
FAIL_UNSUPPORTED ("glibc does not define RSEQ_SIG, skipping test");
|
||||
}
|
||||
#endif /* RSEQ_SIG */
|
||||
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
do_rseq_test ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
@ -1,59 +0,0 @@
|
||||
/* Restartable Sequences tests header.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <support/check.h>
|
||||
#include <syscall.h>
|
||||
#include <sys/rseq.h>
|
||||
|
||||
static inline bool
|
||||
rseq_thread_registered (void)
|
||||
{
|
||||
int32_t v;
|
||||
|
||||
__atomic_load (&__rseq_abi.cpu_id, &v, __ATOMIC_RELAXED);
|
||||
return v >= 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
sys_rseq (struct rseq *rseq_abi, uint32_t rseq_len, int flags, uint32_t sig)
|
||||
{
|
||||
return syscall (__NR_rseq, rseq_abi, rseq_len, flags, sig);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
rseq_available (void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = sys_rseq (NULL, 0, 0, 0);
|
||||
if (rc != -1)
|
||||
FAIL_EXIT1 ("Unexpected rseq return value %d", rc);
|
||||
switch (errno)
|
||||
{
|
||||
case ENOSYS:
|
||||
return false;
|
||||
case EINVAL:
|
||||
/* rseq is implemented, but detected an invalid rseq_len parameter. */
|
||||
return true;
|
||||
default:
|
||||
FAIL_EXIT1 ("Unexpected rseq error %s", strerror (errno));
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/* Restartable Sequences Linux x86 architecture header.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SYS_RSEQ_H
|
||||
# error "Never use <bits/rseq.h> directly; include <sys/rseq.h> instead."
|
||||
#endif
|
||||
|
||||
/* RSEQ_SIG is a signature required before each abort handler code.
|
||||
|
||||
RSEQ_SIG is used with the following reserved undefined instructions, which
|
||||
trap in user-space:
|
||||
|
||||
x86-32: 0f b9 3d 53 30 05 53 ud1 0x53053053,%edi
|
||||
x86-64: 0f b9 3d 53 30 05 53 ud1 0x53053053(%rip),%edi */
|
||||
|
||||
#define RSEQ_SIG 0x53053053
|
@ -2066,7 +2066,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
@ -2163,7 +2163,6 @@ GLIBC_2.30 gettid F
|
||||
GLIBC_2.30 tgkill F
|
||||
GLIBC_2.30 twalk_r F
|
||||
GLIBC_2.32 __libc_single_threaded D 0x1
|
||||
GLIBC_2.32 __rseq_abi T 0x20
|
||||
GLIBC_2.32 pthread_attr_getsigmask_np F
|
||||
GLIBC_2.32 pthread_attr_setaffinity_np F
|
||||
GLIBC_2.32 pthread_attr_setsigmask_np F
|
||||
|
Loading…
Reference in New Issue
Block a user