librseq.git
14 months agoImplement the REUSE specification for licensing and copyright
Michael Jeanson [Mon, 28 Feb 2022 21:50:31 +0000 (16:50 -0500)] 
Implement the REUSE specification for licensing and copyright

See "https://reuse.software/tutorial/", running the linter now returns
this :

$ reuse lint

* Bad licenses:
* Deprecated licenses:
* Licenses without file extension:
* Missing licenses:
* Unused licenses:
* Used licenses: BSD-2-Clause, FSFAP, GPL-2.0-or-later, GPL-3.0-or-later, LicenseRef-Autoconf-exception-macro, Linux-man-pages-copyleft, Linux-syscall-note, MIT
* Read errors: 0
* Files with copyright information: 52 / 52
* Files with license information: 52 / 52

Congratulations! Your project is compliant with version 3.0 of the REUSE Specification :-)

Change-Id: Ifa9f7bc1cbdce204dd8bad4b8978d90b0d7bb90a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
14 months agoRelicense librseq to MIT
Mathieu Desnoyers [Mon, 6 Feb 2023 18:02:01 +0000 (13:02 -0500)] 
Relicense librseq to MIT

For simplicity, relicense all librseq (header files, library
implementation and tests) to MIT.

Header files were previously dual-licensed LGPL2.1/MIT, which is
somewhat redundant with MIT.

rseq.c was licensed under LGPL2.1. Relicence it to MIT to facilitate its
integration into statically built applications.

In order to facilitate eventual code sharing between tests and the
library implementation, relicence the tests from LGPL2.1 to MIT.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Ie819e1527ddffce64e4fe76024e2728e8a723c25

17 months agorseq man page: remove _Nullable from rseq argument
Mathieu Desnoyers [Tue, 10 Jan 2023 19:52:44 +0000 (14:52 -0500)] 
rseq man page: remove _Nullable from rseq argument

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7f19334065d588a0bf4be1c0bde2d6e70e6c2926

17 months agorseq(2) man page: Update following round of feedback and linting
Mathieu Desnoyers [Tue, 10 Jan 2023 16:53:44 +0000 (11:53 -0500)] 
rseq(2) man page: Update following round of feedback and linting

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I025fe0834370700a479f6b6b38941f0ae55c38b6

17 months agoUpdate rseq.2 man page based on comments
Mathieu Desnoyers [Fri, 6 Jan 2023 19:17:23 +0000 (14:17 -0500)] 
Update rseq.2 man page based on comments

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5a9848efa217a77ac2905f6ecdc93b80051194c3

17 months agoUpdate rseq man page
Mathieu Desnoyers [Fri, 6 Jan 2023 17:07:20 +0000 (12:07 -0500)] 
Update rseq man page

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3489828167982430093834ac9877c6d90e1c9733

19 months agoAllowing querying whether libc support rseq
Mathieu Desnoyers [Mon, 31 Oct 2022 14:45:32 +0000 (10:45 -0400)] 
Allowing querying whether libc support rseq

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I903ca816e3ebbaf9c4fff55431b50f58d0090a8c

2 years agoAdd RISC-V rseq support
Michael Jeanson [Mon, 4 Apr 2022 19:58:37 +0000 (15:58 -0400)] 
Add RISC-V rseq support

Change-Id: If6a365a9d003ea9c0e54973aa5d931bd80d33218
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: check if libc rseq support is registered
Michael Jeanson [Mon, 13 Jun 2022 15:37:41 +0000 (15:37 +0000)] 
fix: check if libc rseq support is registered

When checking for libc rseq support in the library constructor, don't
only depend on the symbols presence, check that the registration was
completed.

This targets a scenario where the libc has rseq support but it is not
wired for the current architecture in 'bits/rseq.h', we want to fallback
to our internal registration mechanism.

Change-Id: I662e537a6511fd4fd9e0650feb17e9c72ec39ddc
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoUse ptrdiff_t for rseq_offset
Mathieu Desnoyers [Wed, 2 Feb 2022 16:11:58 +0000 (11:11 -0500)] 
Use ptrdiff_t for rseq_offset

glibc changes the type of __rseq_offset from int to ptrdiff_t before
the official 2.35 release. Adapt to this change.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iaaef60957cf33f5536817fa92136239fe9e9ab74

2 years agoCleanup: x86: remove leftover comment
Mathieu Desnoyers [Tue, 1 Feb 2022 03:29:53 +0000 (22:29 -0500)] 
Cleanup: x86: remove leftover comment

This comment is not relevant anymore with the userspace ABI introduced
by glibc 2.35.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5b54942d84bb12ac0fe2c2246e871e86d51d3af9

2 years agox86-32: use %gs segment selector for accessing rseq thread area
Mathieu Desnoyers [Thu, 20 Jan 2022 20:11:45 +0000 (15:11 -0500)] 
x86-32: use %gs segment selector for accessing rseq thread area

Rather than use rseq_get_abi() and pass its result through a register to
the inline assembler, directly access the per-thread rseq area through a
memory reference combining the %gs segment selector, the constant offset
of the field in struct rseq, and the rseq_offset value (in a register).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ibd6fac4f2f80774ab74ae495cd0f688d789f36b8

2 years agox86-64: use %fs segment selector for accessing rseq thread area
Mathieu Desnoyers [Thu, 20 Jan 2022 19:36:33 +0000 (14:36 -0500)] 
x86-64: use %fs segment selector for accessing rseq thread area

Rather than use rseq_get_abi() and pass its result through a register to
the inline assembler, directly access the per-thread rseq area through a
memory reference combining the %fs segment selector, the constant offset
of the field in struct rseq, and the rseq_offset value (in a register).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia0c93d32b9b36ee1ef6a737a8a5321498fc8c3bc

2 years agoRemove configure check for rseq.h
Mathieu Desnoyers [Mon, 24 Jan 2022 15:17:02 +0000 (10:17 -0500)] 
Remove configure check for rseq.h

Not needed anymore, using own copy.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iec27260a112b55bc7540156b41810406795bd1c2

2 years agoRemove unused ARRAY_SIZE macro
Mathieu Desnoyers [Mon, 24 Jan 2022 15:10:29 +0000 (10:10 -0500)] 
Remove unused ARRAY_SIZE macro

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifa1002ff1458ced26f764660a7f4dc6eb8e259ce

2 years agoUpdate header copyright dates
Mathieu Desnoyers [Mon, 24 Jan 2022 14:48:35 +0000 (09:48 -0500)] 
Update header copyright dates

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I86ba7cc5fc899ae741374e23211af2f92115987e

2 years agoIntroduce rseq-abi.h
Mathieu Desnoyers [Sun, 23 Jan 2022 19:07:54 +0000 (14:07 -0500)] 
Introduce rseq-abi.h

Introduce our own header for the rseq kernel ABI, so we do not depend on
Linux kernel headers.

Use this header's rseq_cs.arch.ptr field as accessor for the rseq_cs ptr
on 32-bit.

Remove the extra/ directory because the copy of the Linux kernel headers
is not needed anymore.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0170f2bcaa7defd3a0d3f9a38115bc7d321ddde2

2 years agoFix: work-around Linux kernel rseq.h uapi endianness issue
Mathieu Desnoyers [Fri, 21 Jan 2022 22:10:25 +0000 (17:10 -0500)] 
Fix: work-around Linux kernel rseq.h uapi endianness issue

Introduce RSEQ_CS_PTR32 to detect and work-around endianness issue for
the rseq_cs ptr32 vs padding fields on little endian 32-bit
architectures.

This does not affect the kernel implementation because the ptr32 field
is not used by the kernel.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Idee8daa16efba8a86655a1eab555f65e0fcea4ca

2 years agoFix: use long rather than int for offsets
Mathieu Desnoyers [Fri, 21 Jan 2022 20:47:12 +0000 (15:47 -0500)] 
Fix: use long rather than int for offsets

Fixes build issue on x86-64 where the assembler expects a 64-bit
register as input. Use long type across all architectures.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9537acf1269e5d3c0ed156e5f93a422ad5608a1b

2 years agoppc: remove incomplete undef list
Mathieu Desnoyers [Fri, 21 Jan 2022 20:33:09 +0000 (15:33 -0500)] 
ppc: remove incomplete undef list

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8f17fc89f34fd671d72a9bb5bcc12ca0bed1ca81

2 years agoFix: use int rather than off_t for offsets
Mathieu Desnoyers [Fri, 21 Jan 2022 20:17:33 +0000 (15:17 -0500)] 
Fix: use int rather than off_t for offsets

off_t can be a 64-bit type on 32-bit systems, leading to issues on
32-bit big endian systems (ppc32) where the inline assembler expects a
32-bit register.

There is no point in using off_t here.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9936a1d8e9b64a51f3e1491f1a23204f1cd9c120

2 years agomips: use rseq_cs ptr 32-bit field
Mathieu Desnoyers [Fri, 21 Jan 2022 20:13:14 +0000 (15:13 -0500)] 
mips: use rseq_cs ptr 32-bit field

On big endian MIPS architectures, the padding field is before the 32-bit
ptr32 field. Access specifically to the 32-bit ptr32 field rather than
padding. It does not change the behavior on little endian.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I798e7b64b22b9c6484fc37c3a6b903b6ca1194f3

2 years agoarm64: refer to rseq_cs.ptr field
Mathieu Desnoyers [Fri, 21 Jan 2022 20:10:26 +0000 (15:10 -0500)] 
arm64: refer to rseq_cs.ptr field

Similarly to other architectures.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I61c17b4874b71ee361666734b6ac68ff591c33fe

2 years agos390/s390x: refer to rseq_cs pointer field
Mathieu Desnoyers [Fri, 21 Jan 2022 20:08:31 +0000 (15:08 -0500)] 
s390/s390x: refer to rseq_cs pointer field

Does not make any different on little endian architecture, but makes it
clearer in case this code is ever ported to a big endian architecture.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6aa9b0fa4eb7ed55556dbff889104970bcc29944

2 years agoarm: refer to 32-bit pointer field for rseq_cs ptr
Mathieu Desnoyers [Fri, 21 Jan 2022 20:05:37 +0000 (15:05 -0500)] 
arm: refer to 32-bit pointer field for rseq_cs ptr

This makes no technical difference on little-endian, but is clearer in
case this code is ever used as reference for a port to a big endian
32-bit architecture.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iaf77c2a1b8e6d8f08be0d26ecb84686a417a07d6

2 years agoFix: ppc32: wrong rseq_cs 32-bit field pointer field on big endian
Mathieu Desnoyers [Fri, 21 Jan 2022 15:37:55 +0000 (10:37 -0500)] 
Fix: ppc32: wrong rseq_cs 32-bit field pointer field on big endian

Update the ptr32 field, not padding.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7066e7f87ac068d729aca6a11f6e9ba233b04279

2 years agoFix: ppc32: do not produce cmpdi invalid instruction
Mathieu Desnoyers [Fri, 21 Jan 2022 15:32:35 +0000 (10:32 -0500)] 
Fix: ppc32: do not produce cmpdi invalid instruction

Introduce RSEQ_CMP_LONG_INT to fix this.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I02e216edde9ceed14777db2789e7297118503683

2 years agoFix: provide membarrier_private_expedited_rseq_available on all architectures
Mathieu Desnoyers [Thu, 20 Jan 2022 20:10:22 +0000 (15:10 -0500)] 
Fix: provide membarrier_private_expedited_rseq_available on all architectures

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I59afb18ba3687587b2712c3b076b170515d255bf

2 years agoTest for membarrier private expedited rseq availability
Mathieu Desnoyers [Mon, 17 Jan 2022 19:10:15 +0000 (14:10 -0500)] 
Test for membarrier private expedited rseq availability

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib24ee6e84f2614b614650f391e7312121f26ab17

2 years agoFix: membarrier flags for kernels headers < 5.10
Mathieu Desnoyers [Mon, 17 Jan 2022 18:01:57 +0000 (13:01 -0500)] 
Fix: membarrier flags for kernels headers < 5.10

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0c31e77a97d62140f162e058a975d47c849c5782

2 years agoTest MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ
Mathieu Desnoyers [Mon, 17 Jan 2022 17:39:56 +0000 (12:39 -0500)] 
Test MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ

Based on Google-internal RSEQ work done by Paul Turner and Andrew
Hunter.

This patch adds a selftest for MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ.
The test quite often fails without the previous patch in this
patchset, but consistently passes with it.

[ Contribution from: Peter Oskolkov <posk@google.com>. ]

[ Modified by Mathieu Desnoyers to use rseq APIs for atomic load/store
  and memory barriers, so it compiles in C++ and with clang. ]

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib10d52e6e933cda2df2f10c29775a79045e4425c

2 years agox86_64: Add rseq_offset_deref_addv()
Mathieu Desnoyers [Mon, 17 Jan 2022 17:39:06 +0000 (12:39 -0500)] 
x86_64: Add rseq_offset_deref_addv()

This patch adds rseq_offset_deref_addv() function to
rseq-x86.h, to be used in a selftest in the next patch in the patchset.

  Once an architecture adds support for this function they should define
  "RSEQ_ARCH_HAS_OFFSET_DEREF_ADDV".

[ Contribution from Peter Oskolkov <posk@google.com>. ]

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia32b27c909a7e41b4262dca3e86b6fb83d0b3bee

2 years agoFix: Warnings about #if checks of undefined tokens
Mathieu Desnoyers [Wed, 5 Jan 2022 17:16:31 +0000 (12:16 -0500)] 
Fix: Warnings about #if checks of undefined tokens

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If7e7f5a6a725e792fce54fee591ba880bc3766a6

2 years agoFix: work-around asm goto compiler bugs
Mathieu Desnoyers [Tue, 21 Dec 2021 18:47:35 +0000 (13:47 -0500)] 
Fix: work-around asm goto compiler bugs

gcc and clang each have their own compiler bugs with respect to asm
goto. Implement a work-around for compiler versions known to have those
bugs.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic745eb61163e90f668fb03707f3013e8981fb5fe

2 years agoRemove arm/mips asm goto compiler work-around
Mathieu Desnoyers [Tue, 21 Dec 2021 19:15:50 +0000 (14:15 -0500)] 
Remove arm/mips asm goto compiler work-around

The arm and mips work-around for asm goto size guess issues are not
properly documented, and lack reference to specific compiler versions,
upstream compiler bug tracker entry, and reproducer.

I can only find a loosely documented patch in my original LKML rseq post
refering to gcc < 7 on ARM, but it does not appear to be sufficient to
track the exact issue. Also, I am not sure MIPS really has the same
limitation.

Therefore, remove the work-around until we can properly document this.

Link: https://lore.kernel.org/lkml/20171121141900.18471-17-mathieu.desnoyers@efficios.com/
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib4b151234e2255e26d26c149b8051ae024d39153

2 years agofix: dead initialization reported by scan-build
Michael Jeanson [Wed, 15 Dec 2021 22:34:56 +0000 (17:34 -0500)] 
fix: dead initialization reported by scan-build

Change-Id: I7f3735f6f6332e1ba66be480ea4a7dfc5d9f84a9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoAdd debug output to basic_percpu_ops_test
Michael Jeanson [Wed, 15 Dec 2021 17:14:18 +0000 (12:14 -0500)] 
Add debug output to basic_percpu_ops_test

Change-Id: Ie881e24b37b5f7debd5f98ba8d753452d31c1a36
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoconfigure: enable extended compiler warnings
Michael Jeanson [Wed, 15 Dec 2021 16:19:08 +0000 (11:19 -0500)] 
configure: enable extended compiler warnings

Import the compiler warning flag detection system from liburcu and
enable extended compiler warnings.

Change-Id: I13bfbaed702c28e2816b13b78fb006462d6d5f92
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoBuild and run tests as C++ programs
Michael Jeanson [Wed, 15 Dec 2021 19:53:52 +0000 (14:53 -0500)] 
Build and run tests as C++ programs

Build and run all tests as C++ programs in addition to C.  This helps
get confidence that rseq, when used from a C++ program, behaves well.

Change-Id: I68d35d9cadcb859aaa6be4a5c620a6c21075c238
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoparam test: Only provide rseq_gettid if BENCHMARK is not defined
Mathieu Desnoyers [Wed, 15 Dec 2021 17:13:34 +0000 (12:13 -0500)] 
param test: Only provide rseq_gettid if BENCHMARK is not defined

Fixes:

param_test.c:20:21: warning: unused function 'rseq_gettid' [-Wunused-function]
static inline pid_t rseq_gettid(void)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I32a14d526263f29034366a9326b0237450088649

2 years agoppc rseq thread pointer: add extended asm
Mathieu Desnoyers [Wed, 15 Dec 2021 15:56:52 +0000 (10:56 -0500)] 
ppc rseq thread pointer: add extended asm

It appears that using "register void *__result asm ("r2")" is not sufficient
to guarantee that the compiler will indeed use this register. It's documented
as being just a hint that the compiler is free to optimize away. [1]

However, when used as input or output operands when calling Extended
asm, the use of the register is forced, which is our intent:

"The only supported use for this feature is to specify registers for input
and output operands when calling Extended asm (see Extended Asm). This may
be necessary if the constraints for a particular machine don't provide sufficient
control to select the desired register. To force an operand into a register,
create a local variable and specify the register name after the variable's
declaration. Then use the local variable for the asm operand and specify
any constraint letter that matches the register: [...]"

Link: https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gcc/Local-Register-Variables.html
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I30ba3cc163a6e52cee5df0ba6806a4a5f9ec97d6

2 years agoIntroduce rseq-generic-thread-pointer.h
Mathieu Desnoyers [Tue, 14 Dec 2021 20:30:20 +0000 (15:30 -0500)] 
Introduce rseq-generic-thread-pointer.h

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie1cf34d64626babd5d81bad5b1f00de88173f1b6

2 years agorseq thread pointer: extern C
Mathieu Desnoyers [Tue, 14 Dec 2021 18:39:14 +0000 (13:39 -0500)] 
rseq thread pointer: extern C

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ibd91f0a8c831b5080a52a5e3bdab2358758068f7

2 years agoIntroduce RSEQ_GET_ABI_OVERRIDE
Mathieu Desnoyers [Tue, 14 Dec 2021 18:27:06 +0000 (13:27 -0500)] 
Introduce RSEQ_GET_ABI_OVERRIDE

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I17c2a2f15b4e45cb95785ff03424a662ca74bbd2

2 years agoAdd missing rseq thread pointer headers to makefile
Mathieu Desnoyers [Tue, 14 Dec 2021 18:24:54 +0000 (13:24 -0500)] 
Add missing rseq thread pointer headers to makefile

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0aecd00cc91dde3b99083d12516ca8aa1a76c55f

2 years agoIntroduce rseq-thread-pointer.h
Mathieu Desnoyers [Tue, 14 Dec 2021 18:23:55 +0000 (13:23 -0500)] 
Introduce rseq-thread-pointer.h

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I89469b2af7da6159ae3348747caab3a33d3b6118

2 years agoUpdate librseq to co-exist with glibc rseq integration
Mathieu Desnoyers [Mon, 13 Dec 2021 15:40:54 +0000 (10:40 -0500)] 
Update librseq to co-exist with glibc rseq integration

Update librseq to co-exist with the rseq integration merged within the
glibc 2.35 release cycle.

librseq exposes its own "rseq_offset, rseq_size, rseq_flags" ABI.

Query for glibc rseq ABI (__rseq_offset, __rseq_size, __rseq_flags)
using dlsym() in a librseq library constructor. If those are found,
copy their values into rseq_offset, rseq_size, and rseq_flags.

Else, if those glibc symbols are not found, handle rseq registration
ourselves and use our own IE-model TLS to implement the rseq ABI
per-thread storage.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1220cb5c31e823e9cddf211ec56fee03b729b137

2 years agoRemove rseq_deref_loadoffp placeholders
Mathieu Desnoyers [Mon, 13 Dec 2021 20:13:49 +0000 (15:13 -0500)] 
Remove rseq_deref_loadoffp placeholders

Remove those empty placeholders.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic40e350c27ccc3da4168a4107cd206da0a08b68e

2 years agoAdd git-review config
Michael Jeanson [Tue, 14 Dec 2021 18:09:28 +0000 (13:09 -0500)] 
Add git-review config

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic3794a3a323d0865b0ac714077c1e2aecfb0a444

3 years agoModernize autotools setup 8/head
Michael Jeanson [Fri, 19 Mar 2021 17:45:34 +0000 (13:45 -0400)] 
Modernize autotools setup

This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoSkip the tests if the rseq syscall is unavailable
Michael Jeanson [Mon, 13 Jul 2020 15:27:27 +0000 (11:27 -0400)] 
Skip the tests if the rseq syscall is unavailable

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoConvert test suite to the TAP test protocol
Michael Jeanson [Wed, 8 Jul 2020 21:09:36 +0000 (17:09 -0400)] 
Convert test suite to the TAP test protocol

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoRemove __rseq_handled declaration
Mathieu Desnoyers [Thu, 9 Jul 2020 15:10:52 +0000 (11:10 -0400)] 
Remove __rseq_handled declaration

Adapt to glibc's ABI.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd parametrized tests
Mathieu Desnoyers [Wed, 8 Jul 2020 21:13:58 +0000 (17:13 -0400)] 
Add parametrized tests

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd basic test
Mathieu Desnoyers [Wed, 8 Jul 2020 21:09:54 +0000 (17:09 -0400)] 
Add basic test

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoCleanup: powerpc: Use "long" and "int" to clarify load/store macros
Mathieu Desnoyers [Wed, 8 Jul 2020 20:45:47 +0000 (16:45 -0400)] 
Cleanup: powerpc: Use "long" and "int" to clarify load/store macros

Using "WORD" to mean either a 32-bit or 64-bit type depending on
the architecture is misleading. The term "WORD" really means a
32-bit type in both 32-bit and 64-bit powerpc assembler. The intent
here is to wrap load/store to intptr_t into common macros for both
32-bit and 64-bit.

Rename the macros with a RSEQ_ prefix, and use the terms "INT"
for always 32-bit type, and "LONG" for architecture bitness-sized
type.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: powerpc: Add missing instruction selection "u" and "x" for load/store
Mathieu Desnoyers [Wed, 8 Jul 2020 14:01:14 +0000 (10:01 -0400)] 
Fix: powerpc: Add missing instruction selection "u" and "x" for load/store

Building the rseq basic test  with
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
Target: powerpc-linux-gnu

leads to these errors:

/tmp/ccieEWxU.s: Assembler messages:
/tmp/ccieEWxU.s:118: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:118: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:121: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:121: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:626: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:626: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:629: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:629: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:735: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:735: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:738: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:738: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:741: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:741: Error: junk at end of line: `,8'
Makefile:581: recipe for target 'basic_percpu_ops_test.o' failed

Based on discussion with Linux powerpc maintainers and review of
the use of the "m" operand in powerpc kernel code, add the missing
%Un%Xn (where n is operand number) to the lwz, stw, ld, and std
instructions when used with "m" operands.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoWire up basic percpu ops test
Mathieu Desnoyers [Tue, 7 Jul 2020 16:47:47 +0000 (12:47 -0400)] 
Wire up basic percpu ops test

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd basic percpu ops test
Mathieu Desnoyers [Tue, 7 Jul 2020 15:58:12 +0000 (11:58 -0400)] 
Add basic percpu ops test

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdapt rseq registration to glibc's userspace ABI for __rseq_abi
Mathieu Desnoyers [Tue, 7 Jul 2020 15:46:32 +0000 (11:46 -0400)] 
Adapt rseq registration to glibc's userspace ABI for __rseq_abi

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoUpdate man page based on Michael Kerrisk's comments
Mathieu Desnoyers [Fri, 5 Jun 2020 18:33:37 +0000 (14:33 -0400)] 
Update man page based on Michael Kerrisk's comments

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoUpdate rseq.2 man page
Mathieu Desnoyers [Fri, 5 Jun 2020 18:22:50 +0000 (14:22 -0400)] 
Update rseq.2 man page

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoWire up man pages build
Mathieu Desnoyers [Fri, 5 Jun 2020 18:11:53 +0000 (14:11 -0400)] 
Wire up man pages build

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoInitial import of rseq.2 man page
Mathieu Desnoyers [Fri, 5 Jun 2020 18:06:18 +0000 (14:06 -0400)] 
Initial import of rseq.2 man page

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoRemove do_on_cpu dependencies
Mathieu Desnoyers [Fri, 5 Jun 2020 17:36:16 +0000 (13:36 -0400)] 
Remove do_on_cpu dependencies

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoRemove do_on_cpu (prototype)
Mathieu Desnoyers [Fri, 5 Jun 2020 17:30:35 +0000 (13:30 -0400)] 
Remove do_on_cpu (prototype)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoCleanup: cplusplus ifdef coding style update
Mathieu Desnoyers [Thu, 19 Sep 2019 14:05:01 +0000 (10:05 -0400)] 
Cleanup: cplusplus ifdef coding style update

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoAllow using librseq APIs from C++ code
Matthew Glazar [Thu, 19 Sep 2019 06:18:02 +0000 (23:18 -0700)] 
Allow using librseq APIs from C++ code

If you call librseq APIs like rseq_available and
rseq_register_current_thread from C++ code, linking fails:

    rseq.cpp:365: undefined reference to `rseq_available()'
    rseq.cpp:46: undefined reference to `rseq_register_current_thread()'

Tell the C++ compiler to treat librseq's exported APIs as having C
mangling, fixing these linker errors.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agomemcpy: copy 8 bytes loop
Mathieu Desnoyers [Wed, 7 Aug 2019 15:03:20 +0000 (11:03 -0400)] 
memcpy: copy 8 bytes loop

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoBump do_on_cpu system call number to 434
Mathieu Desnoyers [Fri, 26 Jul 2019 18:57:20 +0000 (14:57 -0400)] 
Bump do_on_cpu system call number to 434

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoImplement percpu_fence()
Mathieu Desnoyers [Fri, 26 Jul 2019 13:43:38 +0000 (09:43 -0400)] 
Implement percpu_fence()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoFix: add missing do-on-cpu-insn.h to make dist
Mathieu Desnoyers [Fri, 26 Jul 2019 01:24:48 +0000 (21:24 -0400)] 
Fix: add missing do-on-cpu-insn.h to make dist

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoMove to do_on_cpu system call
Mathieu Desnoyers [Wed, 24 Jul 2019 12:33:44 +0000 (13:33 +0100)] 
Move to do_on_cpu system call

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoAdd ARM big-endian support to rseq headers
Mathieu Desnoyers [Sun, 30 Jun 2019 13:41:15 +0000 (09:41 -0400)] 
Add ARM big-endian support to rseq headers

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoFix: Thumb mode build failure on arm32
Mathieu Desnoyers [Sun, 30 Jun 2019 13:32:40 +0000 (09:32 -0400)] 
Fix: Thumb mode build failure on arm32

Using ".arm .inst" for the arm signature introduces build issues for
programs compiled in Thumb mode because the assembler stays in the
arm mode for the rest of the inline assembly. Revert to using a ".word"
to express the signature as data instead.

The choice of signature is a valid trap instruction on arm32 little
endian, where both code and data are little endian.

ARMv6+ big endian (BE8) 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.

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.

Because a ".word" is used to emit the signature, it will be interpreted
as a literal pool by a disassembler, not as an actual instruction.
Considering that the signature is not meant to be executed except in
scenarios where the program execution is completely bogus, this should
not be an issue.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Will Deacon <will.deacon@arm.com>
5 years agorseq/selftests: mips: use break instruction for RSEQ_SIG
Mathieu Desnoyers [Mon, 29 Apr 2019 15:28:02 +0000 (11:28 -0400)] 
rseq/selftests: mips: use break instruction for RSEQ_SIG

Use break as guard instruction for the restartable sequence abort
handler.

Previously, the chosen signature was simply data, based on the
assumption that it could always sit in a literal pool. However,
some compilation environments favor disabling literal pool. Therefore,
ensure the signature is a valid uncommon trap instruction.

commit 16b96b6ed87f "rseq/selftests: mips: use break instruction for
RSEQ_SIG" in the Linux kernel.

Suggested-by: Paul Burton <paul.burton@mips.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agorseq/selftests: powerpc code signature: generate valid instructions
Mathieu Desnoyers [Mon, 29 Apr 2019 15:28:01 +0000 (11:28 -0400)] 
rseq/selftests: powerpc code signature: generate valid instructions

Use "twui" as the guard instruction for the restartable sequence abort
handler.

commit 496fd0fc9f5c "rseq/selftests: powerpc code signature: generate valid
instructions" in the Linux kernel.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agorseq/selftests: aarch64 code signature: handle big-endian environment
Mathieu Desnoyers [Mon, 29 Apr 2019 15:28:00 +0000 (11:28 -0400)] 
rseq/selftests: aarch64 code signature: handle big-endian environment

Handle compiling with -mbig-endian on aarch64, which generates binaries
with mixed code vs data endianness (little endian code, big endian
data).

Else mismatch between code endianness for the generated signatures and
data endianness for the RSEQ_SIG parameter passed to the rseq
registration will trigger application segmentation faults when the
kernel try to abort rseq critical sections.

commit 7cd4ce2e466f "rseq/selftests: aarch64 code signature: handle
big-endian environment" in the Linux kernel.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agorseq/selftests: arm: use udf instruction for RSEQ_SIG
Mathieu Desnoyers [Fri, 3 May 2019 19:38:58 +0000 (15:38 -0400)] 
rseq/selftests: arm: use udf instruction for RSEQ_SIG

Use udf as the guard instruction for the restartable sequence abort
handler.

Previously, the chosen signature was not a valid instruction, based
on the assumption that it could always sit in a literal pool. However,
there are compilation environments in which literal pools are not
available, for instance execute-only code. Therefore, we need to
choose a signature value that is also a valid instruction.

Handle compiling with -mbig-endian on ARMv6+, which generates binaries
with mixed code vs data endianness (little endian code, big endian
data).

Else mismatch between code endianness for the generated signatures and
data endianness for the RSEQ_SIG parameter passed to the rseq
registration will trigger application segmentation faults when the
kernel try to abort rseq critical sections.

Prior to ARMv6, -mbig-endian generates big-endian code and data, so
endianness should not be reversed in that case.

commit 2b845d4b4acd "rseq/selftests: arm: use udf instruction for RSEQ_SIG"
in the Linux kernel.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agorseq/selftests: s390: use trap4 for RSEQ_SIG
Martin Schwidefsky [Mon, 29 Apr 2019 15:27:58 +0000 (11:27 -0400)] 
rseq/selftests: s390: use trap4 for RSEQ_SIG

Use trap4 as the guard instruction for the restartable sequence abort
handler.

commit 3d4d1f05bc99 "rseq/selftests: s390: use trap4 for RSEQ_SIG"
in the Linux kernel.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agorseq/selftests: x86: use ud1 instruction as RSEQ_SIG opcode
Mathieu Desnoyers [Mon, 29 Apr 2019 15:27:57 +0000 (11:27 -0400)] 
rseq/selftests: x86: use ud1 instruction as RSEQ_SIG opcode

Use ud1 as the guard instruction for the restartable sequence abort
handler. Its benefit compared to nopl is to trap execution if the
program ends up trying to execute it by mistake, which makes debugging
easier.

The 4-byte signature per se is unchanged (it is the instruction
operand). Only the opcode is changed from nopl to ud1.

commit 24fa5d1efe98 "rseq/selftests: x86: use ud1 instruction as RSEQ_SIG
opcode" in the Linux kernel.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoRemove volatile, use READ/WRITE ONCE
Mathieu Desnoyers [Tue, 28 May 2019 12:56:12 +0000 (08:56 -0400)] 
Remove volatile, use READ/WRITE ONCE

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agocpu-op: change _mb_ API to _release
Mathieu Desnoyers [Tue, 23 Apr 2019 18:56:11 +0000 (14:56 -0400)] 
cpu-op: change _mb_ API to _release

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agocpu-op: add add_release API
Mathieu Desnoyers [Tue, 23 Apr 2019 18:51:52 +0000 (14:51 -0400)] 
cpu-op: add add_release API

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agocpu-op lib: Change code layout to remove gcc-4.8 warnings
Mathieu Desnoyers [Tue, 23 Apr 2019 18:46:44 +0000 (14:46 -0400)] 
cpu-op lib: Change code layout to remove gcc-4.8 warnings

gcc-4.8 seems to mistakenly think there are missing field initializers
in the cpu-op.c code, e.g.:

cpu-op.c: In function ‘cpu_op_cmpxchg’:
cpu-op.c:94:4: warning: missing initializer for field ‘src’ of ‘struct <anonymous>’ [-Wmissing-field-initializers]
    .u.memcpy_op.src = (unsigned long)n,

Change the code layout so these warnings are not triggered.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoExtend extra/README
Mathieu Desnoyers [Tue, 23 Apr 2019 18:25:35 +0000 (14:25 -0400)] 
Extend extra/README

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoAdd embedded rseq/opv headers for test builds
Michael Jeanson [Mon, 22 Apr 2019 20:46:37 +0000 (16:46 -0400)] 
Add embedded rseq/opv headers for test builds

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agorseq: set refcount back to 1 on unregister failure
Mathieu Desnoyers [Tue, 23 Apr 2019 15:37:30 +0000 (11:37 -0400)] 
rseq: set refcount back to 1 on unregister failure

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoAdd configure report
Michael Jeanson [Mon, 22 Apr 2019 20:21:43 +0000 (16:21 -0400)] 
Add configure report

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoUpdate macros from the autoconf archive
Michael Jeanson [Mon, 22 Apr 2019 19:48:31 +0000 (15:48 -0400)] 
Update macros from the autoconf archive

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agorseq/selftests: x86: Work-around bogus gcc-8 optimisation
Mathieu Desnoyers [Mon, 22 Apr 2019 15:17:12 +0000 (11:17 -0400)] 
rseq/selftests: x86: Work-around bogus gcc-8 optimisation

At least the following versions of gcc-8:
- gcc version 8.0.1 20180414 (experimental) [trunk revision 259383] (Ubuntu 8-20180414-1ubuntu2)
- gcc 8.2.0-7ubuntu1 (Ubuntu 18.10 (Cosmic)),
- gcc 8.3.0

generate broken assembler with asm goto that have a thread-local storage
"m" input operand on both x86-32 and x86-64. For instance:

__thread int var;

static int fct(void)
{
        asm goto (      "jmp %l[testlabel]\n\t"
                        : : [var] "m" (var) : : testlabel);
        return 0;
testlabel:
        return 1;
}

int main()
{
        return fct();
}

% gcc-8 -O2 -o test-asm-goto test-asm-goto.c
/tmp/ccAdHJbe.o: In function `main':
test-asm-goto.c:(.text.startup+0x1): undefined reference to `.L2'
collect2: error: ld returned 1 exit status

% gcc-8 -m32 -O2 -o test-asm-goto test-asm-goto.c
/tmp/ccREsVXA.o: In function `main':
test-asm-goto.c:(.text.startup+0x1): undefined reference to `.L2'
collect2: error: ld returned 1 exit status

Work-around this compiler bug in the rseq-x86.h header by passing the
address of the __rseq_abi TLS as a register operand rather than using
the "m" input operand.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90193
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agos390: use jg instruction for jumps outside of the asm
Mathieu Desnoyers [Wed, 27 Mar 2019 19:56:59 +0000 (15:56 -0400)] 
s390: use jg instruction for jumps outside of the asm

The branch target range of the "j" instruction is 64K, which is not
enough for the general case.

Suggested-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoIntroduce __rseq_handled and rseq_ownership
Mathieu Desnoyers [Mon, 25 Mar 2019 02:43:22 +0000 (22:43 -0400)] 
Introduce __rseq_handled and rseq_ownership

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoRemove "weak" attribute from symbols
Mathieu Desnoyers [Sun, 24 Mar 2019 15:27:11 +0000 (11:27 -0400)] 
Remove "weak" attribute from symbols

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoUpdate exit points comments
Mathieu Desnoyers [Wed, 13 Mar 2019 20:59:06 +0000 (16:59 -0400)] 
Update exit points comments

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoUpdate arm64 SPDX license identifier
Mathieu Desnoyers [Wed, 13 Mar 2019 20:21:41 +0000 (16:21 -0400)] 
Update arm64 SPDX license identifier

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoIntroduce __rseq_cs_ptr_array, rename __rseq_table to __rseq_cs
Mathieu Desnoyers [Wed, 13 Mar 2019 17:20:42 +0000 (13:20 -0400)] 
Introduce __rseq_cs_ptr_array, rename __rseq_table to __rseq_cs

The entries within __rseq_table are aligned on 32 bytes due to
linux/rseq.h struct rseq_cs uapi requirements, but the start of the
__rseq_table section is not guaranteed to be 32-byte aligned. It can
cause padding to be added at the start of the section, which makes it
hard to use as an array of items by debuggers.

Considering that __rseq_table does not really consist of a table due to
the presence of padding, rename this section to __rseq_cs.

Create a new __rseq_cs_ptr_array section which contains 64-bit packed
pointers to entries within the __rseq_cs section.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoAdd __rseq_exit_point_array section for debuggers
Mathieu Desnoyers [Wed, 13 Mar 2019 15:41:01 +0000 (11:41 -0400)] 
Add __rseq_exit_point_array section for debuggers

Knowing all exit points is useful to assist debuggers stepping over the
rseq critical sections without requiring them to disassemble the content
of the critical section to figure out the exit points.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoAdd arm64 rseq header
Mathieu Desnoyers [Wed, 13 Mar 2019 15:18:56 +0000 (11:18 -0400)] 
Add arm64 rseq header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoAutotools all the things!
Michael Jeanson [Mon, 11 Mar 2019 19:59:22 +0000 (15:59 -0400)] 
Autotools all the things!

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.04924 seconds and 4 git commands to generate.