Skip to content

Commit

Permalink
selftests/rseq: Fix ppc32 offsets by using long rather than off_t
Browse files Browse the repository at this point in the history
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
  • Loading branch information
compudj authored and Peter Zijlstra committed Feb 2, 2022
1 parent de6b52a commit 26dc8a6
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tools/testing/selftests/rseq/basic_percpu_ops_test.c
Expand Up @@ -167,7 +167,7 @@ struct percpu_list_node *this_cpu_list_pop(struct percpu_list *list,
for (;;) {
struct percpu_list_node *head;
intptr_t *targetptr, expectnot, *load;
off_t offset;
long offset;
int ret, cpu;

cpu = rseq_cpu_start();
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/rseq/param_test.c
Expand Up @@ -549,7 +549,7 @@ struct percpu_list_node *this_cpu_list_pop(struct percpu_list *list,
for (;;) {
struct percpu_list_node *head;
intptr_t *targetptr, expectnot, *load;
off_t offset;
long offset;
int ret;

cpu = rseq_cpu_start();
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/rseq/rseq-arm.h
Expand Up @@ -217,7 +217,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)

static inline __attribute__((always_inline))
int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
off_t voffp, intptr_t *load, int cpu)
long voffp, intptr_t *load, int cpu)
{
RSEQ_INJECT_C(9)

Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/rseq/rseq-arm64.h
Expand Up @@ -259,7 +259,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)

static inline __attribute__((always_inline))
int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
off_t voffp, intptr_t *load, int cpu)
long voffp, intptr_t *load, int cpu)
{
RSEQ_INJECT_C(9)

Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/rseq/rseq-mips.h
Expand Up @@ -222,7 +222,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)

static inline __attribute__((always_inline))
int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
off_t voffp, intptr_t *load, int cpu)
long voffp, intptr_t *load, int cpu)
{
RSEQ_INJECT_C(9)

Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/rseq/rseq-ppc.h
Expand Up @@ -270,7 +270,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)

static inline __attribute__((always_inline))
int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
off_t voffp, intptr_t *load, int cpu)
long voffp, intptr_t *load, int cpu)
{
RSEQ_INJECT_C(9)

Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/rseq/rseq-s390.h
Expand Up @@ -198,7 +198,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
*/
static inline __attribute__((always_inline))
int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
off_t voffp, intptr_t *load, int cpu)
long voffp, intptr_t *load, int cpu)
{
RSEQ_INJECT_C(9)

Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/rseq/rseq-skip.h
Expand Up @@ -13,7 +13,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)

static inline __attribute__((always_inline))
int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
off_t voffp, intptr_t *load, int cpu)
long voffp, intptr_t *load, int cpu)
{
return -1;
}
Expand Down
6 changes: 3 additions & 3 deletions tools/testing/selftests/rseq/rseq-x86.h
Expand Up @@ -172,7 +172,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
*/
static inline __attribute__((always_inline))
int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
off_t voffp, intptr_t *load, int cpu)
long voffp, intptr_t *load, int cpu)
{
RSEQ_INJECT_C(9)

Expand Down Expand Up @@ -286,7 +286,7 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
* *pval += inc;
*/
static inline __attribute__((always_inline))
int rseq_offset_deref_addv(intptr_t *ptr, off_t off, intptr_t inc, int cpu)
int rseq_offset_deref_addv(intptr_t *ptr, long off, intptr_t inc, int cpu)
{
RSEQ_INJECT_C(9)

Expand Down Expand Up @@ -750,7 +750,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
*/
static inline __attribute__((always_inline))
int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
off_t voffp, intptr_t *load, int cpu)
long voffp, intptr_t *load, int cpu)
{
RSEQ_INJECT_C(9)

Expand Down

0 comments on commit 26dc8a6

Please sign in to comment.