[glibc/release/2.41/master] tests: fix tst-rseq with Linux 7.0
Aurelien Jarno via Glibc-cvs <[email protected]>
| Newsgroups | gmane.comp.lib.glibc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=47c0cc364dcfc7376bf7156d0cf1f27fb38d230a commit 47c0cc364dcfc7376bf7156d0cf1f27fb38d230a Author: Michael Jeanson <[email protected]> Date: Fri Feb 20 11:01:00 2026 -0500 tests: fix tst-rseq with Linux 7.0 A sub-test of tst-rseq is to validate the return code and errno of the rseq syscall when attempting to register the exact same rseq area as was done in the dynamic loader. This involves finding the rseq area address by adding the '__rseq_offset' to the thread pointer and calculating the area size from the AT_RSEQ_FEATURE_SIZE auxiliary vector. However the test currently calculates the size of the rseq area allocation in the TLS block which must be a multiple of AT_RSEQ_ALIGN. Up until now that happened to be the same value since the feature size and alignment exposed by the kernel were below the minimum ABI size of 32. Starting with Linux 7.0 the feature size has reached 33 while the alignment is now 64. This results in the test trying to re-register the rseq area with a different size and thus not getting the expected errno value. Signed-off-by: Michael Jeanson <[email protected]> Reviewed-by: Mathieu Desnoyers <[email protected]> (cherry picked from commit 67f303b47dc584f204e3f2441b9832082415eebc) Diff: --- sysdeps/unix/sysv/linux/tst-rseq.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sysdeps/unix/sysv/linux/tst-rseq.c b/sysdeps/unix/sysv/linux/tst-rseq.c index 00181cfefb..e83ea2b939 100644 --- a/sysdeps/unix/sysv/linux/tst-rseq.c +++ b/sysdeps/unix/sysv/linux/tst-rseq.c @@ -48,8 +48,7 @@ do_rseq_main_test (void) size_t rseq_align = MAX (getauxval (AT_RSEQ_ALIGN), RSEQ_MIN_ALIGN); size_t rseq_feature_size = MAX (getauxval (AT_RSEQ_FEATURE_SIZE), RSEQ_AREA_SIZE_INITIAL_USED); - size_t rseq_alloc_size = roundup (MAX (rseq_feature_size, - RSEQ_AREA_SIZE_INITIAL_USED), rseq_align); + size_t rseq_reg_size = MAX (rseq_feature_size, RSEQ_AREA_SIZE_INITIAL); struct rseq *rseq_abi = __thread_pointer () + __rseq_offset; TEST_VERIFY_EXIT (rseq_thread_registered ()); @@ -89,8 +88,8 @@ do_rseq_main_test (void) /* Test a rseq registration with the same arguments as the internal registration which should fail with errno == EBUSY. */ TEST_VERIFY (((unsigned long) rseq_abi % rseq_align) == 0); - TEST_VERIFY (__rseq_size <= rseq_alloc_size); - int ret = syscall (__NR_rseq, rseq_abi, rseq_alloc_size, 0, RSEQ_SIG); + TEST_VERIFY (__rseq_size <= rseq_reg_size); + int ret = syscall (__NR_rseq, rseq_abi, rseq_reg_size, 0, RSEQ_SIG); TEST_VERIFY (ret != 0); TEST_COMPARE (errno, EBUSY); }