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

selftests/rseq: Fix ppc32 offsets by using long rather than off_t

The semantic of off_t is for file offsets. We mean to use it as an
offset from a pointer. We really expect it to fit in a single register,
and not use a 64-bit type on 32-bit architectures.

Fix runtime issues on ppc32 where the offset is always 0 due to
inconsistency between the argument type (off_t -> 64-bit) and type
expected by the inline assembler (32-bit).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-11-mathieu.desnoyers@efficios.com

authored by

Mathieu Desnoyers and committed by
Peter Zijlstra
26dc8a6d de6b52a2

+11 -11
+1 -1
tools/testing/selftests/rseq/basic_percpu_ops_test.c
··· 167 167 for (;;) { 168 168 struct percpu_list_node *head; 169 169 intptr_t *targetptr, expectnot, *load; 170 - off_t offset; 170 + long offset; 171 171 int ret, cpu; 172 172 173 173 cpu = rseq_cpu_start();
+1 -1
tools/testing/selftests/rseq/param_test.c
··· 549 549 for (;;) { 550 550 struct percpu_list_node *head; 551 551 intptr_t *targetptr, expectnot, *load; 552 - off_t offset; 552 + long offset; 553 553 int ret; 554 554 555 555 cpu = rseq_cpu_start();
+1 -1
tools/testing/selftests/rseq/rseq-arm.h
··· 217 217 218 218 static inline __attribute__((always_inline)) 219 219 int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, 220 - off_t voffp, intptr_t *load, int cpu) 220 + long voffp, intptr_t *load, int cpu) 221 221 { 222 222 RSEQ_INJECT_C(9) 223 223
+1 -1
tools/testing/selftests/rseq/rseq-arm64.h
··· 259 259 260 260 static inline __attribute__((always_inline)) 261 261 int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, 262 - off_t voffp, intptr_t *load, int cpu) 262 + long voffp, intptr_t *load, int cpu) 263 263 { 264 264 RSEQ_INJECT_C(9) 265 265
+1 -1
tools/testing/selftests/rseq/rseq-mips.h
··· 222 222 223 223 static inline __attribute__((always_inline)) 224 224 int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, 225 - off_t voffp, intptr_t *load, int cpu) 225 + long voffp, intptr_t *load, int cpu) 226 226 { 227 227 RSEQ_INJECT_C(9) 228 228
+1 -1
tools/testing/selftests/rseq/rseq-ppc.h
··· 270 270 271 271 static inline __attribute__((always_inline)) 272 272 int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, 273 - off_t voffp, intptr_t *load, int cpu) 273 + long voffp, intptr_t *load, int cpu) 274 274 { 275 275 RSEQ_INJECT_C(9) 276 276
+1 -1
tools/testing/selftests/rseq/rseq-s390.h
··· 198 198 */ 199 199 static inline __attribute__((always_inline)) 200 200 int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, 201 - off_t voffp, intptr_t *load, int cpu) 201 + long voffp, intptr_t *load, int cpu) 202 202 { 203 203 RSEQ_INJECT_C(9) 204 204
+1 -1
tools/testing/selftests/rseq/rseq-skip.h
··· 13 13 14 14 static inline __attribute__((always_inline)) 15 15 int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, 16 - off_t voffp, intptr_t *load, int cpu) 16 + long voffp, intptr_t *load, int cpu) 17 17 { 18 18 return -1; 19 19 }
+3 -3
tools/testing/selftests/rseq/rseq-x86.h
··· 172 172 */ 173 173 static inline __attribute__((always_inline)) 174 174 int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, 175 - off_t voffp, intptr_t *load, int cpu) 175 + long voffp, intptr_t *load, int cpu) 176 176 { 177 177 RSEQ_INJECT_C(9) 178 178 ··· 286 286 * *pval += inc; 287 287 */ 288 288 static inline __attribute__((always_inline)) 289 - int rseq_offset_deref_addv(intptr_t *ptr, off_t off, intptr_t inc, int cpu) 289 + int rseq_offset_deref_addv(intptr_t *ptr, long off, intptr_t inc, int cpu) 290 290 { 291 291 RSEQ_INJECT_C(9) 292 292 ··· 750 750 */ 751 751 static inline __attribute__((always_inline)) 752 752 int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, 753 - off_t voffp, intptr_t *load, int cpu) 753 + long voffp, intptr_t *load, int cpu) 754 754 { 755 755 RSEQ_INJECT_C(9) 756 756