Skip to content

Commit c346b94

Browse files
AmanieuChristian Brauner
authored andcommitted
xtensa: Implement copy_thread_tls
This is required for clone3 which passes the TLS value through a struct rather than a register. Signed-off-by: Amanieu d'Antras <[email protected]> Cc: [email protected] Cc: <[email protected]> # 5.3.x Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 20bda4e commit c346b94

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

arch/xtensa/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ config XTENSA
2424
select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
2525
select HAVE_ARCH_KASAN if MMU && !XIP_KERNEL
2626
select HAVE_ARCH_TRACEHOOK
27+
select HAVE_COPY_THREAD_TLS
2728
select HAVE_DEBUG_KMEMLEAK
2829
select HAVE_DMA_CONTIGUOUS
2930
select HAVE_EXIT_THREAD

arch/xtensa/kernel/process.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,9 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
202202
* involved. Much simpler to just not copy those live frames across.
203203
*/
204204

205-
int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn,
206-
unsigned long thread_fn_arg, struct task_struct *p)
205+
int copy_thread_tls(unsigned long clone_flags, unsigned long usp_thread_fn,
206+
unsigned long thread_fn_arg, struct task_struct *p,
207+
unsigned long tls)
207208
{
208209
struct pt_regs *childregs = task_pt_regs(p);
209210

@@ -266,9 +267,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn,
266267

267268
childregs->syscall = regs->syscall;
268269

269-
/* The thread pointer is passed in the '4th argument' (= a5) */
270270
if (clone_flags & CLONE_SETTLS)
271-
childregs->threadptr = childregs->areg[5];
271+
childregs->threadptr = tls;
272272
} else {
273273
p->thread.ra = MAKE_RA_FOR_CALL(
274274
(unsigned long)ret_from_kernel_thread, 1);

0 commit comments

Comments
 (0)