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

selftests/rseq: Change type of rseq_offset to ptrdiff_t

Just before the 2.35 release of glibc, the __rseq_offset userspace ABI
was changed from int to ptrdiff_t.

Adapt to this change in the kernel selftests.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://sourceware.org/pipermail/libc-alpha/2022-February/136024.html

authored by

Mathieu Desnoyers and committed by
Peter Zijlstra
889c5d60 c8eaf6ac

+12 -10
+7 -7
tools/testing/selftests/rseq/rseq-x86.h
··· 143 143 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 144 144 : /* gcc asm goto does not allow outputs */ 145 145 : [cpu_id] "r" (cpu), 146 - [rseq_offset] "r" ((long)rseq_offset), 146 + [rseq_offset] "r" (rseq_offset), 147 147 [v] "m" (*v), 148 148 [expect] "r" (expect), 149 149 [newv] "r" (newv) ··· 214 214 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 215 215 : /* gcc asm goto does not allow outputs */ 216 216 : [cpu_id] "r" (cpu), 217 - [rseq_offset] "r" ((long)rseq_offset), 217 + [rseq_offset] "r" (rseq_offset), 218 218 /* final store input */ 219 219 [v] "m" (*v), 220 220 [expectnot] "r" (expectnot), ··· 270 270 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 271 271 : /* gcc asm goto does not allow outputs */ 272 272 : [cpu_id] "r" (cpu), 273 - [rseq_offset] "r" ((long)rseq_offset), 273 + [rseq_offset] "r" (rseq_offset), 274 274 /* final store input */ 275 275 [v] "m" (*v), 276 276 [count] "er" (count) ··· 329 329 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 330 330 : /* gcc asm goto does not allow outputs */ 331 331 : [cpu_id] "r" (cpu), 332 - [rseq_offset] "r" ((long)rseq_offset), 332 + [rseq_offset] "r" (rseq_offset), 333 333 /* final store input */ 334 334 [ptr] "m" (*ptr), 335 335 [off] "er" (off), ··· 387 387 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 388 388 : /* gcc asm goto does not allow outputs */ 389 389 : [cpu_id] "r" (cpu), 390 - [rseq_offset] "r" ((long)rseq_offset), 390 + [rseq_offset] "r" (rseq_offset), 391 391 /* try store input */ 392 392 [v2] "m" (*v2), 393 393 [newv2] "r" (newv2), ··· 469 469 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 470 470 : /* gcc asm goto does not allow outputs */ 471 471 : [cpu_id] "r" (cpu), 472 - [rseq_offset] "r" ((long)rseq_offset), 472 + [rseq_offset] "r" (rseq_offset), 473 473 /* cmp2 input */ 474 474 [v2] "m" (*v2), 475 475 [expect2] "r" (expect2), ··· 581 581 #endif 582 582 : /* gcc asm goto does not allow outputs */ 583 583 : [cpu_id] "r" (cpu), 584 - [rseq_offset] "r" ((long)rseq_offset), 584 + [rseq_offset] "r" (rseq_offset), 585 585 /* final store input */ 586 586 [v] "m" (*v), 587 587 [expect] "r" (expect),
+3 -2
tools/testing/selftests/rseq/rseq.c
··· 27 27 #include <signal.h> 28 28 #include <limits.h> 29 29 #include <dlfcn.h> 30 + #include <stddef.h> 30 31 31 32 #include "../kselftest.h" 32 33 #include "rseq.h" 33 34 34 - static const int *libc_rseq_offset_p; 35 + static const ptrdiff_t *libc_rseq_offset_p; 35 36 static const unsigned int *libc_rseq_size_p; 36 37 static const unsigned int *libc_rseq_flags_p; 37 38 38 39 /* Offset from the thread pointer to the rseq area. */ 39 - int rseq_offset; 40 + ptrdiff_t rseq_offset; 40 41 41 42 /* Size of the registered rseq area. 0 if the registration was 42 43 unsuccessful. */
+2 -1
tools/testing/selftests/rseq/rseq.h
··· 16 16 #include <errno.h> 17 17 #include <stdio.h> 18 18 #include <stdlib.h> 19 + #include <stddef.h> 19 20 #include "rseq-abi.h" 20 21 #include "compiler.h" 21 22 ··· 48 47 #include "rseq-thread-pointer.h" 49 48 50 49 /* Offset from the thread pointer to the rseq area. */ 51 - extern int rseq_offset; 50 + extern ptrdiff_t rseq_offset; 52 51 /* Size of the registered rseq area. 0 if the registration was 53 52 unsuccessful. */ 54 53 extern unsigned int rseq_size;