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
@@ -235,8 +235,8 @@ 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),
|
||||
[current_cpu_id] "m" (__rseq_abi.cpu_id),
|
||||
[rseq_cs] "m" (__rseq_abi.rseq_cs),
|
||||
[current_cpu_id] "m" (rseq_get_abi()->cpu_id),
|
||||
[rseq_cs] "m" (rseq_get_abi()->rseq_cs),
|
||||
[v] "m" (*v),
|
||||
[expect] "r" (expect),
|
||||
[newv] "r" (newv)
|
||||
@@ -301,8 +301,8 @@ 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),
|
||||
[current_cpu_id] "m" (__rseq_abi.cpu_id),
|
||||
[rseq_cs] "m" (__rseq_abi.rseq_cs),
|
||||
[current_cpu_id] "m" (rseq_get_abi()->cpu_id),
|
||||
[rseq_cs] "m" (rseq_get_abi()->rseq_cs),
|
||||
/* final store input */
|
||||
[v] "m" (*v),
|
||||
[expectnot] "r" (expectnot),
|
||||
@@ -359,8 +359,8 @@ 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),
|
||||
[current_cpu_id] "m" (__rseq_abi.cpu_id),
|
||||
[rseq_cs] "m" (__rseq_abi.rseq_cs),
|
||||
[current_cpu_id] "m" (rseq_get_abi()->cpu_id),
|
||||
[rseq_cs] "m" (rseq_get_abi()->rseq_cs),
|
||||
/* final store input */
|
||||
[v] "m" (*v),
|
||||
[count] "r" (count)
|
||||
@@ -419,8 +419,8 @@ 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),
|
||||
[current_cpu_id] "m" (__rseq_abi.cpu_id),
|
||||
[rseq_cs] "m" (__rseq_abi.rseq_cs),
|
||||
[current_cpu_id] "m" (rseq_get_abi()->cpu_id),
|
||||
[rseq_cs] "m" (rseq_get_abi()->rseq_cs),
|
||||
/* try store input */
|
||||
[v2] "m" (*v2),
|
||||
[newv2] "r" (newv2),
|
||||
@@ -489,8 +489,8 @@ 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),
|
||||
[current_cpu_id] "m" (__rseq_abi.cpu_id),
|
||||
[rseq_cs] "m" (__rseq_abi.rseq_cs),
|
||||
[current_cpu_id] "m" (rseq_get_abi()->cpu_id),
|
||||
[rseq_cs] "m" (rseq_get_abi()->rseq_cs),
|
||||
/* try store input */
|
||||
[v2] "m" (*v2),
|
||||
[newv2] "r" (newv2),
|
||||
@@ -560,8 +560,8 @@ 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),
|
||||
[current_cpu_id] "m" (__rseq_abi.cpu_id),
|
||||
[rseq_cs] "m" (__rseq_abi.rseq_cs),
|
||||
[current_cpu_id] "m" (rseq_get_abi()->cpu_id),
|
||||
[rseq_cs] "m" (rseq_get_abi()->rseq_cs),
|
||||
/* cmp2 input */
|
||||
[v2] "m" (*v2),
|
||||
[expect2] "r" (expect2),
|
||||
@@ -635,8 +635,8 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
|
||||
RSEQ_ASM_DEFINE_ABORT(4, abort)
|
||||
: /* gcc asm goto does not allow outputs */
|
||||
: [cpu_id] "r" (cpu),
|
||||
[current_cpu_id] "m" (__rseq_abi.cpu_id),
|
||||
[rseq_cs] "m" (__rseq_abi.rseq_cs),
|
||||
[current_cpu_id] "m" (rseq_get_abi()->cpu_id),
|
||||
[rseq_cs] "m" (rseq_get_abi()->rseq_cs),
|
||||
/* final store input */
|
||||
[v] "m" (*v),
|
||||
[expect] "r" (expect),
|
||||
@@ -711,8 +711,8 @@ int rseq_cmpeqv_trymemcpy_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),
|
||||
[current_cpu_id] "m" (__rseq_abi.cpu_id),
|
||||
[rseq_cs] "m" (__rseq_abi.rseq_cs),
|
||||
[current_cpu_id] "m" (rseq_get_abi()->cpu_id),
|
||||
[rseq_cs] "m" (rseq_get_abi()->rseq_cs),
|
||||
/* final store input */
|
||||
[v] "m" (*v),
|
||||
[expect] "r" (expect),
|
||||
|
||||
Reference in New Issue
Block a user