Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/rseq: 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.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/r/20220614154830.1367382-4-mjeanson@efficios.com

authored by

Michael Jeanson and committed by
Peter Zijlstra
d1a997ba d47c0cc9

+2 -1
+2 -1
tools/testing/selftests/rseq/rseq.c
··· 111 111 libc_rseq_offset_p = dlsym(RTLD_NEXT, "__rseq_offset"); 112 112 libc_rseq_size_p = dlsym(RTLD_NEXT, "__rseq_size"); 113 113 libc_rseq_flags_p = dlsym(RTLD_NEXT, "__rseq_flags"); 114 - if (libc_rseq_size_p && libc_rseq_offset_p && libc_rseq_flags_p) { 114 + if (libc_rseq_size_p && libc_rseq_offset_p && libc_rseq_flags_p && 115 + *libc_rseq_size_p != 0) { 115 116 /* rseq registration owned by glibc */ 116 117 rseq_offset = *libc_rseq_offset_p; 117 118 rseq_size = *libc_rseq_size_p;