fix: check if libc rseq support is registered
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 13 Jun 2022 15:37:41 +0000 (15:37 +0000)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 13 Jun 2022 20:05:27 +0000 (16:05 -0400)
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>
src/rseq.c

index adfb62b2ebda53b35cb742a9ee8a898be1241d84..7fafc08b17b7cc396194f82ab1d8d50f6f89d77f 100644 (file)
@@ -111,7 +111,8 @@ void rseq_init(void)
        libc_rseq_offset_p = dlsym(RTLD_NEXT, "__rseq_offset");
        libc_rseq_size_p = dlsym(RTLD_NEXT, "__rseq_size");
        libc_rseq_flags_p = dlsym(RTLD_NEXT, "__rseq_flags");
-       if (libc_rseq_size_p && libc_rseq_offset_p && libc_rseq_flags_p) {
+       if (libc_rseq_size_p && libc_rseq_offset_p && libc_rseq_flags_p &&
+                       *libc_rseq_size_p != 0) {
                /* rseq registration owned by glibc */
                rseq_offset = *libc_rseq_offset_p;
                rseq_size = *libc_rseq_size_p;
This page took 0.027128 seconds and 4 git commands to generate.