Skip to content

Commit a4376f2

Browse files
AmanieuChristian Brauner
authored andcommitted
arm64: 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 Acked-by: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 3e3c8ca commit a4376f2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

arch/arm64/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ config ARM64
138138
select HAVE_CMPXCHG_DOUBLE
139139
select HAVE_CMPXCHG_LOCAL
140140
select HAVE_CONTEXT_TRACKING
141+
select HAVE_COPY_THREAD_TLS
141142
select HAVE_DEBUG_BUGVERBOSE
142143
select HAVE_DEBUG_KMEMLEAK
143144
select HAVE_DMA_CONTIGUOUS

arch/arm64/kernel/process.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
360360

361361
asmlinkage void ret_from_fork(void) asm("ret_from_fork");
362362

363-
int copy_thread(unsigned long clone_flags, unsigned long stack_start,
364-
unsigned long stk_sz, struct task_struct *p)
363+
int copy_thread_tls(unsigned long clone_flags, unsigned long stack_start,
364+
unsigned long stk_sz, struct task_struct *p, unsigned long tls)
365365
{
366366
struct pt_regs *childregs = task_pt_regs(p);
367367

@@ -394,11 +394,11 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,
394394
}
395395

396396
/*
397-
* If a TLS pointer was passed to clone (4th argument), use it
398-
* for the new thread.
397+
* If a TLS pointer was passed to clone, use it for the new
398+
* thread.
399399
*/
400400
if (clone_flags & CLONE_SETTLS)
401-
p->thread.uw.tp_value = childregs->regs[3];
401+
p->thread.uw.tp_value = tls;
402402
} else {
403403
memset(childregs, 0, sizeof(struct pt_regs));
404404
childregs->pstate = PSR_MODE_EL1h;

0 commit comments

Comments
 (0)