Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Opt into HAVE_COPY_THREAD_TLS

This the mips version of commit c1bd55f922a2d ("x86: opt into
HAVE_COPY_THREAD_TLS, for both 32-bit and 64-bit").

Simply use the tls system call argument instead of extracting the tls
argument by magic from the pt_regs structure.

See commit 3033f14ab78c3 ("clone: support passing tls argument via C
rather than pt_regs magic") for more background.

Signed-off-by: James Cowgill <James.Cowgill@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/15855/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

James Cowgill and committed by
Ralf Baechle
f9c4e3a6 759f534e

+4 -3
+1
arch/mips/Kconfig
··· 70 70 select HAVE_EXIT_THREAD 71 71 select HAVE_REGS_AND_STACK_ACCESS_API 72 72 select HAVE_ARCH_HARDENED_USERCOPY 73 + select HAVE_COPY_THREAD_TLS 73 74 74 75 menu "Machine selection" 75 76
+3 -3
arch/mips/kernel/process.c
··· 114 114 /* 115 115 * Copy architecture-specific thread state 116 116 */ 117 - int copy_thread(unsigned long clone_flags, unsigned long usp, 118 - unsigned long kthread_arg, struct task_struct *p) 117 + int copy_thread_tls(unsigned long clone_flags, unsigned long usp, 118 + unsigned long kthread_arg, struct task_struct *p, unsigned long tls) 119 119 { 120 120 struct thread_info *ti = task_thread_info(p); 121 121 struct pt_regs *childregs, *regs = current_pt_regs(); ··· 176 176 atomic_set(&p->thread.bd_emu_frame, BD_EMUFRAME_NONE); 177 177 178 178 if (clone_flags & CLONE_SETTLS) 179 - ti->tp_value = regs->regs[7]; 179 + ti->tp_value = tls; 180 180 181 181 return 0; 182 182 }