From: Mathieu Desnoyers Date: Fri, 21 Jan 2022 20:17:33 +0000 (-0500) Subject: Fix: use int rather than off_t for offsets X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=07fac86574c717fe45efc1b5f466748cdf39e836;p=librseq.git Fix: use int rather than off_t for offsets off_t can be a 64-bit type on 32-bit systems, leading to issues on 32-bit big endian systems (ppc32) where the inline assembler expects a 32-bit register. There is no point in using off_t here. Signed-off-by: Mathieu Desnoyers Change-Id: I9936a1d8e9b64a51f3e1491f1a23204f1cd9c120 --- diff --git a/include/rseq/rseq-arm.h b/include/rseq/rseq-arm.h index 9ffce22..c6fa158 100644 --- a/include/rseq/rseq-arm.h +++ b/include/rseq/rseq-arm.h @@ -218,7 +218,7 @@ error2: static inline __attribute__((always_inline)) int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, - off_t voffp, intptr_t *load, int cpu) + int voffp, intptr_t *load, int cpu) { RSEQ_INJECT_C(9) diff --git a/include/rseq/rseq-arm64.h b/include/rseq/rseq-arm64.h index 3d83d7f..b61b228 100644 --- a/include/rseq/rseq-arm64.h +++ b/include/rseq/rseq-arm64.h @@ -265,7 +265,7 @@ error2: static inline __attribute__((always_inline)) int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, - off_t voffp, intptr_t *load, int cpu) + int voffp, intptr_t *load, int cpu) { RSEQ_INJECT_C(9) diff --git a/include/rseq/rseq-mips.h b/include/rseq/rseq-mips.h index dd10677..ca0c8e0 100644 --- a/include/rseq/rseq-mips.h +++ b/include/rseq/rseq-mips.h @@ -218,7 +218,7 @@ error2: static inline __attribute__((always_inline)) int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, - off_t voffp, intptr_t *load, int cpu) + int voffp, intptr_t *load, int cpu) { RSEQ_INJECT_C(9) diff --git a/include/rseq/rseq-ppc.h b/include/rseq/rseq-ppc.h index 13c6fab..387dc89 100644 --- a/include/rseq/rseq-ppc.h +++ b/include/rseq/rseq-ppc.h @@ -279,7 +279,7 @@ error2: static inline __attribute__((always_inline)) int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, - off_t voffp, intptr_t *load, int cpu) + int voffp, intptr_t *load, int cpu) { RSEQ_INJECT_C(9) diff --git a/include/rseq/rseq-s390.h b/include/rseq/rseq-s390.h index 0c1edb5..aa8ebab 100644 --- a/include/rseq/rseq-s390.h +++ b/include/rseq/rseq-s390.h @@ -207,7 +207,7 @@ error2: */ static inline __attribute__((always_inline)) int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, - off_t voffp, intptr_t *load, int cpu) + int voffp, intptr_t *load, int cpu) { RSEQ_INJECT_C(9) diff --git a/include/rseq/rseq-skip.h b/include/rseq/rseq-skip.h index 8c49810..c5592fb 100644 --- a/include/rseq/rseq-skip.h +++ b/include/rseq/rseq-skip.h @@ -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) + int voffp, intptr_t *load, int cpu) { return -1; } @@ -65,7 +65,7 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect, } static inline __attribute__((always_inline)) -int rseq_deref_loadoffp(void *p, off_t voffp, intptr_t *load, int cpu) +int rseq_deref_loadoffp(void *p, int voffp, intptr_t *load, int cpu) { return -1; } diff --git a/include/rseq/rseq-x86.h b/include/rseq/rseq-x86.h index b2f13ee..a7ed624 100644 --- a/include/rseq/rseq-x86.h +++ b/include/rseq/rseq-x86.h @@ -178,7 +178,7 @@ error2: */ static inline __attribute__((always_inline)) int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, - off_t voffp, intptr_t *load, int cpu) + int voffp, intptr_t *load, int cpu) { RSEQ_INJECT_C(9) @@ -300,7 +300,7 @@ error1: * *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, int off, intptr_t inc, int cpu) { RSEQ_INJECT_C(9) @@ -636,7 +636,7 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect, * into @load. */ static inline __attribute__((always_inline)) -int rseq_deref_loadoffp(intptr_t *p, off_t voffp, intptr_t *load, int cpu) +int rseq_deref_loadoffp(intptr_t *p, int voffp, intptr_t *load, int cpu) { RSEQ_INJECT_C(9) @@ -844,7 +844,7 @@ error2: */ static inline __attribute__((always_inline)) int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot, - off_t voffp, intptr_t *load, int cpu) + int voffp, intptr_t *load, int cpu) { RSEQ_INJECT_C(9) @@ -1421,7 +1421,7 @@ error2: * into @load. */ static inline __attribute__((always_inline)) -int rseq_deref_loadoffp(intptr_t *p, off_t voffp, intptr_t *load, int cpu) +int rseq_deref_loadoffp(intptr_t *p, int voffp, intptr_t *load, int cpu) { RSEQ_INJECT_C(9) diff --git a/tests/basic_percpu_ops_test.c b/tests/basic_percpu_ops_test.c index 9b6bc22..9aa0d43 100644 --- a/tests/basic_percpu_ops_test.c +++ b/tests/basic_percpu_ops_test.c @@ -179,8 +179,7 @@ static 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; - int ret, cpu; + int offset, ret, cpu; cpu = rseq_cpu_start(); targetptr = (intptr_t *)&list->c[cpu].head; diff --git a/tests/param_test.c b/tests/param_test.c index 5ed560e..a292972 100644 --- a/tests/param_test.c +++ b/tests/param_test.c @@ -562,8 +562,7 @@ static 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; - int ret; + int offset, ret; cpu = rseq_cpu_start(); targetptr = (intptr_t *)&list->c[cpu].head;