rseq/selftests: Use __rseq_handled symbol to coexist with glibc
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 29 Apr 2019 15:27:55 +0000 (11:27 -0400)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 7 May 2019 21:31:46 +0000 (15:31 -0600)
commit5b0c308a0565a94d2e1070cbf287197b676faaaf
treeea40e240db1dd0b3f0d3761ceffbe9a47dd76769
parenta3e3131f94aa1daeb978ed66d0b4e61156ef2c2a
rseq/selftests: Use __rseq_handled symbol to coexist with glibc

In order to integrate rseq into user-space applications, expose a
__rseq_handled symbol so many rseq users can be linked into the same
application (e.g. librseq and glibc).

The __rseq_refcount TLS variable is static to the librseq library. It
ensures that rseq syscall registration/unregistration happens only for
the most early/late caller to rseq_{,un}register_current_thread for each
thread, thus ensuring that rseq is registered across the lifetime of all
rseq users for a given thread.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Shuah Khan <shuah@kernel.org>
CC: Carlos O'Donell <carlos@redhat.com>
CC: Florian Weimer <fweimer@redhat.com>
CC: Joseph Myers <joseph@codesourcery.com>
CC: Szabolcs Nagy <szabolcs.nagy@arm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Ben Maurer <bmaurer@fb.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
CC: Boqun Feng <boqun.feng@gmail.com>
CC: Will Deacon <will.deacon@arm.com>
CC: Dave Watson <davejwatson@fb.com>
CC: Paul Turner <pjt@google.com>
CC: linux-api@vger.kernel.org
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/rseq/rseq.c
tools/testing/selftests/rseq/rseq.h