mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
selftests/rseq: Introduce rseq_get_abi() helper
This is done in preparation for the selftest uplift to become compatible with glibc-2.35. glibc-2.35 exposes the rseq per-thread data in the TCB, accessible at an offset from the thread pointer, rather than through an actual Thread-Local Storage (TLS) variable, as the kernel selftests initially expected. Introduce a rseq_get_abi() helper, initially using the __rseq_abi TLS variable, in preparation for changing this userspace ABI for one which is compatible with glibc-2.35. Note that the __rseq_abi TLS and glibc-2.35's ABI for per-thread data cannot actively coexist in a process, because the kernel supports only a single rseq registration per thread. 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-6-mathieu.desnoyers@efficios.com
This commit is contained in:
committed by
Peter Zijlstra
parent
94b80a19eb
commit
e546cd48cc
@@ -141,7 +141,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
|
||||
RSEQ_ASM_DEFINE_ABORT(4, "", abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
[v] "m" (*v),
|
||||
[expect] "r" (expect),
|
||||
[newv] "r" (newv)
|
||||
@@ -207,7 +207,7 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
|
||||
RSEQ_ASM_DEFINE_ABORT(4, "", abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* final store input */
|
||||
[v] "m" (*v),
|
||||
[expectnot] "r" (expectnot),
|
||||
@@ -258,7 +258,7 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
|
||||
RSEQ_ASM_DEFINE_ABORT(4, "", abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* final store input */
|
||||
[v] "m" (*v),
|
||||
[count] "er" (count)
|
||||
@@ -314,7 +314,7 @@ int rseq_offset_deref_addv(intptr_t *ptr, off_t off, intptr_t inc, int cpu)
|
||||
RSEQ_ASM_DEFINE_ABORT(4, "", abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* final store input */
|
||||
[ptr] "m" (*ptr),
|
||||
[off] "er" (off),
|
||||
@@ -372,7 +372,7 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
|
||||
RSEQ_ASM_DEFINE_ABORT(4, "", abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* try store input */
|
||||
[v2] "m" (*v2),
|
||||
[newv2] "r" (newv2),
|
||||
@@ -449,7 +449,7 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
|
||||
RSEQ_ASM_DEFINE_ABORT(4, "", abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* cmp2 input */
|
||||
[v2] "m" (*v2),
|
||||
[expect2] "r" (expect2),
|
||||
@@ -555,7 +555,7 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
|
||||
#endif
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* final store input */
|
||||
[v] "m" (*v),
|
||||
[expect] "r" (expect),
|
||||
@@ -719,7 +719,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
|
||||
RSEQ_ASM_DEFINE_ABORT(4, "", abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
[v] "m" (*v),
|
||||
[expect] "r" (expect),
|
||||
[newv] "r" (newv)
|
||||
@@ -785,7 +785,7 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
|
||||
RSEQ_ASM_DEFINE_ABORT(4, "", abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* final store input */
|
||||
[v] "m" (*v),
|
||||
[expectnot] "r" (expectnot),
|
||||
@@ -836,7 +836,7 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
|
||||
RSEQ_ASM_DEFINE_ABORT(4, "", abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* final store input */
|
||||
[v] "m" (*v),
|
||||
[count] "ir" (count)
|
||||
@@ -894,7 +894,7 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
|
||||
RSEQ_ASM_DEFINE_ABORT(4, "", abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* try store input */
|
||||
[v2] "m" (*v2),
|
||||
[newv2] "m" (newv2),
|
||||
@@ -962,7 +962,7 @@ int rseq_cmpeqv_trystorev_storev_release(intptr_t *v, intptr_t expect,
|
||||
RSEQ_ASM_DEFINE_ABORT(4, "", abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* try store input */
|
||||
[v2] "m" (*v2),
|
||||
[newv2] "r" (newv2),
|
||||
@@ -1032,7 +1032,7 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
|
||||
RSEQ_ASM_DEFINE_ABORT(4, "", abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* cmp2 input */
|
||||
[v2] "m" (*v2),
|
||||
[expect2] "r" (expect2),
|
||||
@@ -1142,7 +1142,7 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
|
||||
#endif
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* final store input */
|
||||
[v] "m" (*v),
|
||||
[expect] "m" (expect),
|
||||
@@ -1255,7 +1255,7 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect,
|
||||
#endif
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[rseq_abi] "r" (&__rseq_abi),
|
||||
[rseq_abi] "r" (rseq_get_abi()),
|
||||
/* final store input */
|
||||
[v] "m" (*v),
|
||||
[expect] "m" (expect),
|
||||
|
||||
Reference in New Issue
Block a user